notify-send is a command-line tool that is used to send desktop notifications on Linux systems. It utilizes the current desktop environment’s notification system to display a notification to the user. The tool can be used to display a notification with a custom message and title. It supports several options, such as setting the urgency level of the notification, adding an icon to the notification, or specifying the time the notification should display.
notify-send works with most popular desktop environments, including Gnome, Unity, KDE, and Xfce. By using the notification system provided by the desktop environment, notify-send ensures that notifications are displayed consistently across different applications, and that they follow the user’s notification preferences.
For example, to display a notification with the message “This is a test message” and the title “Test notification”, you would run the following command:
# notify-send "Test notification" "This is a test message"
If you encounter the below error while running the command notify-send:
notify-send: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install libnotify-bin |
Ubuntu | apt-get install libnotify-bin |
Alpine | apk add libnotify |
Arch Linux | pacman -S libnotify |
Kali Linux | apt-get install libnotify-bin |
CentOS | yum install libnotify |
Fedora | dnf install libnotify |
OS X | brew install libnotify |
Raspbian | apt-get install libnotify-bin |
notify-send Command Examples
1. Show a notification with the title “Test” and the content “This is a test”:
# notify-send "Test" "This is a test"
2. Show a notification with a custom icon:
# notify-send -i icon.png "Test" "This is a test"
3. Show a notification for 5 seconds:
# notify-send -t 5000 "Test" "This is a test"
4. Show a notification with an app’s icon and name:
# notify-send "Test" --icon=google-chrome --app-name="Google Chrome"