Send Desktop Notifications using notify-send on Ubuntu

Send Desktop Notifications using notify-send on Ubuntu

When you're working with terminal windows, shell scripts, and background tasks, it's easy to miss what's going on - especially if you're multitasking or running long commands. That's where desktop notifications can be really helpful. This tutorial shows how to send desktop notifications using notify-send on Ubuntu.

The notify-send is a simple command line tool that sends desktop notifications on Linux systems that support the freedesktop.org notification specification - which includes Ubuntu and many other distros.

The notify-send utility requires only one mandatory argument: the notification summary. Here's a basic example of how to use it:

notify-send "Hello world"
Notification with summary on Ubuntu

To provide more details in a notification, you can add a body as the second argument; it appears below the summary in the notification.

notify-send "Summary" "Body"
Notification with summary and body on Ubuntu

You can use a few HTML tags in the notification body to add basic formatting, such as:

  • <b></b> for bold
  • <i></i> for italic
  • <u></u> for underline
  • <a></a> for hyperlinks
notify-send "Summary" "<b>Body</b>"
Notification with summary and formatted body on Ubuntu

With -a option, we can specify an application name to appear in the notification:

notify-send -a "App" "Hello world"
Notification with application name on Ubuntu

Notifications can be assigned one of three urgency levels: critical, normal, or low. To set the urgency when using the notify-send command, simply add the -u option followed by the desired level.

notify-send -u critical "Hello world"

Leave a Comment

Cancel reply

Your email address will not be published.