How to Send Desktop Notifications in Linux

This post explains how to send custom desktop notifications in GNU/Linux. These commands were tested on Ubuntu 16.04.

The command to use is notify-send followed by a title and optional body.

notify-send 'The Title' 'The Body'

It looks something like this on my computer:

notify-send output on Ubuntu 16.04

The command can accept options too.



You can show an icon in the notification. On Ubuntu 16.04, the icons come from /usr/share/icons/gnome/32x32.

Try these examples to see how it works:

notify-send -i filesaveas 'File saved' 'kitten.gif was saved to ~/Downloads'
notify-send -i call-start 'Incoming Call' 'Alice is calling'
# note the backticks below which output the current date
notify-send -i weather-few-clouds 'Weather Report' "It's partly cloudy on `date`"

You can use custom icons like this:

notify-send -i ~/Pictures/kitten.jpg 'Incoming Kitten' 'meow'

It looks like this:

Kitten pic

The source image in that screenshot was 100x100 pixels.


The order of the notifications can be set with the -u (--urgency) option.

Here are some examples:

notify-send -u 'normal' 'Message' '1: normal urgency message'
notify-send -u 'low' 'Message' '2: low urgency message'
notify-send -u 'critical' 'Message' '3: critical urgency message'

If you paste all three lines into a terminal at once, message #3 will show before message #2 because of the critical urgency.

Expire Time

The man page says that “Ubuntu’s Notify OSD and GNOME Shell both ignore this parameter”, but the -t option should otherwise set the notification time in milliseconds.

More Options

You can type man notify-send for a couple more options.