[Bits And Pieces] Ubuntu terminal notification

How many times you had to check your terminal to see if a current job is done? Or multiple terminals? This sometimes can be a time consuming or you can just forget you have been doing something and then you must start the process all over again. Well one solution can be using NotifyOSD to get a notification when a job in terminal has completed. I found this old blog post by Dustin Kirkland how you can easily implement a notification to your terminal tasks.

First you need to install NotifyOSD : sudo apt-get install libnotify-bin in order to send notifications to NotifyOSD.

Next you edit your ~/.bashrc file (in your home directory and add these line:

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)"

Example usage:

~$ sleep 5;alert

Comments are closed.

top Hackers For Charity