Dustin Kirkland, Ubuntu Server developer, recently posted something very interesting on his blog: an "alias", which you can add to the .bashrc file so that when a process run from a terminal has finished its work, a notification bubble appears using NotifyOSD (that is, in the same way that a notification appears when a friend connects or similar).
Receiving these types of notifications can be very useful, especially when performing long and complex tasks in the terminal, such as compiling a program, etc. Surely if you use the terminal a lot, this tip will come in handy. |
What to do
1. First, edit your ~ / .bashrc file:
gedit ~ / .bashrc
and paste the following line at the end of the file:
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)"'
What it does is create an alias. An alias allows you to execute a long and complicated command by typing a simple word, easier to remember. Thus, executing this long and complicated command from the terminal, which would also take a long time to write, becomes a super easy task. In this specific case, what we did is tell the system that when we enter «; alert »at the end of any command, it alerts us when it finishes its execution.
2. Install libnotify-bin:
sudo apt-get install libnotify-bin
3. Finally, we make the "source" of the .bashrc:
source ~/.bashrc
Now, let's try it!
As I mentioned before, all you have to do is add «; alert »at the end of any command so that you will receive a notification (via NotifyOSD) when it completes.
For example, I wrote:
sleep 20; alert
So when you want to compile a program, I wrote:
make; alert
Via | WebUpd8
This is not only very interesting but very useful to me ... because the truth is that sometimes I forget that I had things running in the XD terminal
Thank you very much for the input, to try it has been said!
By the way, how good that you are back!
Hello, I am writing to inform you that I have changed the url of the gnu / linux space that appears in your blogroll, I would like you to update it so that we can continue linking our blogs. The current url of GNU / Linux Space is http://www.espaciognulinux.comthank you and have a nice day