Use notify-send Command in Ubuntu to Send Desktop Notifications

Do you like to see a pop-up message near your system tray that gives information about the time a system has been up? This can be easily done with the 'notify-send' command line tool.

notify-send can be used to send desktop notifications to the user from the command line. It has many useful options that help to inform a user about an event. Do you guys know what do we need now?

We need a terminal (CTRL+ALT+T if you are using Ubuntu). I like to experiment alot and try things out, so let me run the following command in my terminal and see what happens.

notify-send 'Linoxide Notifications'

Upps, this is what i get after running the above command.

notify-send command in action

It is time to try another command, cool stuff.

notify-send command in action

notify-send command in action

You can see that we can specify a title for the message we want to send, in our case the title is 'Linoxide Notification'.

The message will be not displayed for a long time on the screen, but the -t option can be used in this case to specify the timeout in milliseconds.

notify-send 'Display this message for 13 seconds' -t 13 000

.

A very nice option that i like to use is the --icon (-i) option which specifies an icon filename or stock icon to display.

Do you want to give a try to the following command?

notify-send -i "notification-network-wireless-low" 'Wireless' 'Weak Signal'

using the icon option with the notify-send command

using notifications icon

How did i find this notification icon? There is a list of notifications icons here in the bottom of the page, but since i am a nice and caring guy i will share some of these icons with you guys.

Some notification icons you may need in the future:

  1. notification-audio-next
  2. notification-audio-volume-low
  3. notification-battery-low
  4. notification-device-eject
  5. notification-GSM-3G-full
  6. notification-network-wireless-high

Cooking Time!

Yes, it is the moment to cook a very simple but useful bash script which will help us to display a notification near your system tray about the time your system has been up.

#!/bin/bash

while [ 1 ]; do

notify-send 'Uptime' "`uptime`"

done

The above script will run forever and it will execute the notify-send 'Uptime' "`uptime`" command which will help us to get information about system's uptime.

About Oltjano Terpollari

Oltjano Terpollari is a very passionate computer geek studying python, linux, netcat power tools and living a binary life. He goes by the nickname Ambition and is very happy living a science life. He also loves technical blogging and sharing his knowledge with others.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.