Linux command
ntfy 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Publish a message to a topic
ntfy publish [topic] "[message]"
Publish with title and priority
ntfy publish --title "[title]" --priority [high] [topic] "[message]"
Publish with emoji tags
ntfy publish --tags "[warning,skull]" [topic] "[message]"
Subscribe to a topic
ntfy subscribe [topic]
Subscribe and execute command on message
ntfy subscribe [topic] "[command]"
Run the ntfy server
ntfy serve
说明
ntfy is a simple HTTP-based pub-sub notification service. It allows sending push notifications to phones and desktops via topics. The same binary serves as both the client (publish/subscribe) and the server. Messages can be published from the CLI, via curl, or any HTTP client. Subscribers receive real-time push notifications on mobile apps, the web interface, or the command line.
参数
- publish _TOPIC_ _MESSAGE_
- Send notification to a topic. Aliases: send, trigger, pub.
- subscribe _TOPIC_ _COMMAND_
- Subscribe to topic notifications. Optionally run command on message arrival.
- serve
- Run the ntfy server (self-hosted).
- --priority _LEVEL_
- Set priority: min, low, default, high, max (or 1-5).
- --title _TITLE_
- Set notification title.
- --tags _TAGS_
- Add emoji tags (comma-separated).
- --attach _URL_
- Attach a file via URL.
- --server _URL_
- Specify ntfy server URL (default: ntfy.sh).
- --user _USER_
- Username for authentication.
- --since _TIME_
- Receive messages since time or message ID (with subscribe).
- --help
- Display help information.
FAQ
What is the ntfy command used for?
ntfy is a simple HTTP-based pub-sub notification service. It allows sending push notifications to phones and desktops via topics. The same binary serves as both the client (publish/subscribe) and the server. Messages can be published from the CLI, via curl, or any HTTP client. Subscribers receive real-time push notifications on mobile apps, the web interface, or the command line.
How do I run a basic ntfy example?
Run `ntfy publish [topic] "[message]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does publish _TOPIC_ _MESSAGE_ do in ntfy?
Send notification to a topic. Aliases: send, trigger, pub.