It is very useful when you are about to start a bulk job and want to get notified asynchronously after its completion. That helps you continue with other work without having to check for its completion periodically. Of course if you don’t have any other work, you can at least play few games without bothering about the job completion.
There is a command in Linux called “notify-send” that can be used to generate a desktop notification from command line or a script. However where exactly this notification message appears depends entirely on the desktop you are using. For example, if you are using GNOME, you will see the message at rightmost-top or rightmost-bottom based on your panel placement.
How to install
First of al, you should check if you have notify-send command installed in your system. if not, you can install it as follows:
On Fedora/RHEL
yum -y install libnotify
On Ubuntu
sudo apt-get install libnotify-bin
Basic usage
You can see the basic usage using “notify-send –help” command:
[mark@techpulp ~]$ notify-send --help
Usage:
notify-send [OPTION...] <SUMMARY> [BODY] - create a notification
Help Options:
-?, --help Show help options
Application Options:
-u, --urgency=LEVEL Specifies the urgency level (low, normal, critical).
-t, --expire-time=TIME Specifies the timeout in milliseconds at which to expire the notification.
-i, --icon=ICON[,ICON...] Specifies an icon filename or stock icon to display.
-c, --category=TYPE[,TYPE...] Specifies the notification category.
-h, --hint=TYPE:NAME:VALUE Specifies basic extra data to pass. Valid types are int, double, string and byte.
-v, --version Version of the package.
[mark@techpulp ~]$
Let us run the command to show a desktop notification message
[mark@techpulp ~]$ notify-send "Hey Mark, You compilation of Linux Kernel is Successful"
This would show a message like the following.

Notification of notify-send command
When you want to show rather a larger message, it is better to have a caption. Let us try following command that shows a caption and a message.
[mark@techpulp ~]$ notify-send "Data Backup Task" "Hey, All files are backed up along with database files. However you should manually verify once."
The above command displays notification as follows.

Caption and Message using notify-send command
You can add an icon to the message to make it appear more sensible. In this case, I am using a stock icon.
[mark@techpulp ~]# notify-send -i face-tired "Meeting" "Oh! not again. That all hands meeting starting in 10 minutes."
This shows a notification message as follows:

Notification with Stock Icon
You can find possible stock icons as follows (of course gnome specific):
[mark@techpulp ~]# ls /usr/share/icons/gnome/32x32/emotes/
face-angel.png face-sick.png stock_smiley-15.png
face-angry.png face-smile-big.png stock_smiley-18.png
face-cool.png face-smile.png stock_smiley-1.png
face-crying.png face-smirk.png stock_smiley-22.png
face-devilish.png face-surprise.png stock_smiley-2.png
face-embarrassed.png face-tired.png stock_smiley-3.png
face-kiss.png face-uncertain.png stock_smiley-4.png
face-laugh.png face-wink.png stock_smiley-5.png
face-monkey.png face-worried.png stock_smiley-6.png
face-plain.png stock_smiley-10.png stock_smiley-7.png
face-raspberry.png stock_smiley-11.png stock_smiley-8.png
face-sad.png stock_smiley-13.png
[mark@techpulp ~]#
You can use your own icon by specifying its full path “-i” option.
[mark@techpulp ~]# notify-send -i /usr/share/icons/gnome/32x32/emotes/face-sad.png "Meeting" "Oh! not again. That all hands meeting starting in 10 minutes."
Generally the notification displayed using notify-send disappears after few seconds. You can control the time for which the notification should be visible using “-t” option. Note that the value passed to -t option is in milli-seconds. If you want the message to be there forever until the user closes it, you need to pass “0” as time out value.
Display notification for 10 seconds:
[mark@techpulp ~]# notify-send -t 10000 -i face-sad "Meeting" "Oh! not again. That all hands meeting starting in 10 minutes."
Display notification without auto disappearance.
[mark@techpulp ~]# notify-send -t 0 -i face-sad "Meeting" "Oh! not again. That all hands meeting starting in 10 minutes."