Command Line Magic

Occasionally I perform time-intensive tasks on the command line like compiling, downloading or shuffling around large files. It would be nice to know when a task has been completed, so why not use GNOME's integrated notification system for this? The screenshot below shows what it can look like:


It's quite easy to set up: Under Ubuntu, first install the libnotify-bin package from the repositories if it isn't already installed, and then add the following lines to your ~/.bashrc file:

alias alert_helper='history|tail -n1|sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*alert$//"'
alias alert='notify-send -i "$alert_picture" "FINISHED: $(alert_helper)"'

Finally, read in the updated .bashrc file with the following command:

source ~/.bashrc

And we're done! Now you will receive notifications whenever you append '; alert' to your commands. As an example, here's the command that produces the notification shown in the screenshot:

wget; alert