As an Ubuntu desktop user, I still use the command-line a lot, as sometimes I find it easy to perform certain tasks using it. And other times, I’m ‘forced’ to use it as I cannot find a graphical tool to get the job done.
Nevertheless, as a desktop user, it is not always practical to keep an eye on the ‘Terminal window’ (command-line) once a command is executed as there are some commands that take a long time to finish, such as ‘make’, ‘make install’ (used while compiling programs). So one would simply start doing something else till it is done.
And if a command gets interrupted due to an error, it might take a few more minutes for you to even realize it, because you got carried away with other tasks and forgot to have a look at the Terminal window. So wouldn’t it be nice if there was a tool that notifies us when a certain command (s) finishes or interrupted ?
In that case, if you’re an Ubuntu user, then there is this simple but extremely useful tool called ‘undistract-me’ that does exactly that!.
Once it is installed, you can execute a command in the Terminal window and simply minimize it and if the command takes more than 10 seconds to finish, then ‘undistract-me’ will notify you with a simple notification message as shown in the above screenshot.
If you think the 10 seconds ‘threshold’ is a bit aggressive then you can easily change the timeout as well.
If interested, you can install it in Ubuntu 12.10 Quantal Quetzal and 12.04 Precise Pangolin using its PPA. For that, please use the below commands.
sudo apt-add-repository ppa:undistract-me-packagers/daily
sudo apt-get update
sudo apt-get install undistract-me
In order for it to run, you have to make a small adjustment in the ‘Gnome Terminal’ in Ubuntu.
Step 1: For that, open a Terminal window and from its menu go to: ‘Edit’ -> ‘Profile Preferences’.
Step 2: From the next window, click on the ‘Title and Commands’ tab. Then under the ‘Command’ sub heading, put a check mark to enable the option called ‘Run command as a login shell’ and close the window.
Now close the Terminal window too and re-open it to apply the changes.
That’s it, now try entering a command and if it takes more than 10 seconds to finish, then you should see a notification bubble on your Desktop!.
Changing the timeout …
As said, you can easily change the default 10 seconds time-scale. For that, open your Terminal window and enter the below command.
gksudo gedit /usr/share/undistract-me/long-running.bash
Then locate a line of text that say ‘LONG_RUNNING_COMMAND_TIMEOUT=10′ as shown below (it is located around the beginning of this configuration file).
Now simply change the value ’10’, with the amount of seconds that you want ‘undistract-me’ to wait.
Let’s say that I wanted to make it 25 seconds, then I’ll replace 10 with 25. Once done your change, click on the ‘Save’ button and close the text editor. Then for the changes to apply, restart the Terminal window (if you had it opened).
That’s it. A big thanks goes to the ‘undistract-me’ developers for creating it :).