an alias you can add to your .bashrc file to get notified when a job you run in a terminal is done. A simple solution for something I've been looking for in a long time. Dustin Kirkland, Core Developer of the Ubuntu Server posted something very interesting on his blog . A simple solution for something I've been looking for in a long time.





Getting notified when the job you're running in the terminal is done can be very useful since when you compile something or run some other time consuming task, you usually don't care what's going on inside the terminal until whatever you were running is done, right? So you switch to some other window(s) meaning you have to constantly keep checking the terminal window to see when it's done. And that's not exactly productive. Further more, you may occasionally forget you were running something in the terminal.





Dustin's simple alias makes it very easy to get a notification bubble (using NotifyOSD) when the job you're running in the terminal is done.

Setting everything up

gedit ~/.bashrc

alias alert_helper='history|tail -n1|sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*alert$//"' alias alert='notify-send -i /usr/share/icons/gnome/32x32/apps/gnome-terminal.png "[$?] $(alert_helper)"'

sudo apt-get install libnotify-bin

source ~/.bashrc

Try it out

sleep 20; alert

make; alert

Many thanks to Dustin Kirkland for the alias!

To use it, simply edit your ~/.bashrc file:and paste this at the end of the file:Then make sure you have libnotify-bin installed:Now source your .bashrc:To get notified when a job you run in a terminal is done, add "; alert" at the end of a command (without the quotes).Example: If you want to get notified when you compile some program, run the "make" command like this: