If you followed my last post on new features in elementary OS Freya, you would know that it is ‘introducing’ a new terminal feature. This new feature is desktop notification when a command completes in terminal. I particularly liked this feature because some command takes quite some time in complete and I get distracted in the meantime. This notification alerts me to go back to what I was doing.
While this is a default feature in elementary OS Freya, rest of the Linux users need not to despair. You can get notification for terminal command completion in Ubuntu 14.04, 14.10. 15.04 and other Linux distributions such as Linux Mint 17, Pinguy OS etc, thanks to undistract-me.
Get desktop notification for command completion in Ubuntu
This is no longer developed
undistract-me has been discontinued. Even though you can find it on Ubuntu’s repositories and install it, it no longer works and hasn’t seen a new release for the last 2 years.
undistract-me is a utility that uses notify-usd to notify you of a console command completion. It works only with Bash. To install undistract-me, use the following command in a terminal:
sudo apt install undistract-me
How to use it
To make undistract-me work, you’ll need to do some modification in the ~/.bashrc file. Open it with your favorite text editor and add the following line to it:
. /usr/share/undistract-me/long-running.bash
notify_when_long_running_commands_finish_install
Source the bashrc file like this:
source ~/.bashrc
By default it notifies on the completion, if a command runs for more than 10 second. You can change this default behavior by changing the value of LONG_RUNNING_COMMAND_TIMEOUT in file /usr/share/undistract-me/long-running.bash
If you want to test whether or not undistract-me works properly, just run sleep 11 in the terminal. This will just wait for 11 second and at the end of it, you should see a notification like this:
Even if you do not program, you might find it handy while installing an application via PPA. The apt-get update command might take some time to run, depending upon available updates and your network speed.
I hope you find this little tool useful in your desktop Linux experience with terminal notification. In other terminal trick, you can change sudo password time period. If you have questions or suggestion, feel free to drop a comment.
I know this is an old post but it help me.
It was not working for me so here is the up to date line that you have to add.
echo ‘source /etc/profile.d/undistract-me.sh’ >> ~/.bashrc
Source: https://github.com/jml/undistract-me/
does it work with zsh ?
i modified zhsrc file with
. /usr/share/undistract-me/long-running.bash
notify_when_long_running_commands_finish_install
fi
Hello I’m quite new to Ubuntu. please help me . I followed the steps as described and now I’m getting this error when i login in ubuntu zand when i open the terminal (as shown in 1st and 2nd images respectively ) .This is how my .bashrc file looks at present.Have i copied
“. /usr/share/undistract-me/long-running.bash
notify_when_long_running_commands_finish_install”
at wrong location ?
Don’t include the quotes “”.
Please look at third image which i have attached. there are no quotes there. (3rd line from the top , in image). Have i copied the lines at right place ?
That’s not correct. First remove the # because it makes the entire line as comment.
So altogether, you should be adding this single line:
. /usr/share/undistract-me/long-running.bash notify_when_long_running_commands_finish_install
thanks ! But now i’m getting a new error !! here is the screen shot . And i checked ,the file exist in the specified location ! Please look at second image too [edited bash file]
Thanks !! It’s working now as expected ! :]
Welcome Rishi.
My 14.04 Xubuntu box thanks you. Do you by any chance know how can i eliminate the title “Long terminal command” from the notification?
I don’t have it anymore but I presume this could be done if you look for “Long Command” in the source code.
[…] I particularly liked this feature because I often forget after running a command and when I go back in terminal, I have to enter my password again for the sudo commands. If you are using any other Linux distribution, you can get terminal notifications with this trick. […]