Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Most of the application can show nicely formatted notification on events that appear on top right corner of the screen. I'm about to write a bash script that will do fairy long processing in the background and I really want to know when it is finished. How can I show that nice notification from a bash script?

share|improve this question

5 Answers 5

up vote 47 down vote accepted

If you're using the new notification system in Jaunty, you want the notify-send command

notify-send - a program to send desktop notifications

SYNOPSIS

With notify-send you can sends desktop notifications to the user via
a notification daemon from the command line.  These notifications can be
used to inform the user about an event or display some form of information
without getting in the user's way.

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.
share|improve this answer
2  
Thanks, just found it myself :) apt-get install libnotify-bin have to be run before to get it. –  vava Aug 29 '09 at 10:39
    
How does the root user send a message from crons, init.d, etc? –  Lance Caraccioli Nov 22 '13 at 4:38
    
Eg: notify-send Test "Hello World" –  Thaha kp Jun 4 at 8:26

Found another way, through Zenity

echo 'message:hi' | zenity --notification --listen

(This also has the benefit of already being installed on Ubuntu.)

share|improve this answer

For KDE users:

$ kdialog --title "Long process completed!" --passivepopup "This popup will disappear in 5 seconds" 5 &
share|improve this answer
    
Is it possible to set an icon for the notification? –  Malabarba May 14 '12 at 4:18

There's also xmessage that will pop-up a window, so it should work on any X11 system.

Pro: It also allows interactively prompting the user with buttons.

Con: Like any pop-up alert, it typically receives focus, so if you're in the middle of typing it can disappear before you read the message.

share|improve this answer
    
Con: It looks ugly as hell, and also is a super tiny window which is not always obvious to the user. Anyways, it is universal though. :) –  Nik Reiman May 6 '13 at 11:37
    
xmessage doesn't work in Fedora though. Its not installed by default. –  Abhay Mittal Jun 3 at 16:47

In a shell script, you can also call the osd_cat utility from libxosd.

share|improve this answer
1  
This is a little bit different as it doesn't use ubuntu desktop notifications. –  vava Aug 29 '09 at 13:43
    
Yes, this is an alternative that you can use with any Linux distribution and any WM/DE. –  geek Aug 30 '09 at 13:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.