The other day, reading the excellent blog WebUpd8, I discovered a tool to receive a notification at the end of the execution a command in the terminal, which can be useful in cases where this task can take several minutes. Honestly, I do not think it is the best solution. For that reason, here we propose other alternativesPlus traineeships and simple. |
undistract-me
Andrew's recommended tool is Unidstract-me.
Installation in Ubuntu and derivatives:
sudo add-apt-repository ppa: undistract-me-packagers / daily sudo apt-get update sudo apt-get install undistract-me
To use it, you must enable the option "Run command as login terminal" in the terminal of your preference. In the one that comes with GNOME we can enable this option under Edit> Profile Preferences.
Once installed, any command that takes more than 10 seconds will display a message upon completion.
other alternatives
The advantage of the methods shown below are several:
- they run only when the user requests it
- do not require the installation of additional programs (usually the necessary packages are already installed in almost all popular distros)
- if laziness eats away at you, you can easily turn them into a script
- they are super fast, do not consume resources and are easy to learn
notify-send
To display Ubuntu-style Notification messages, you must have notify-send installed. Ubuntu, Linux Mint, and derivatives come with this package installed by default. Arch users can install it from the AUR.
Then, just add && notify-send "Done!" at the end of the command we want to execute. Assuming that the command to execute was cat:
cat file && notify-send "Done!"
zenity
A more "complex" notification system is Zenity, with which we can display dialog boxes with buttons, etc.
As with notify-send, just add && zenity –info –text = »Finished!» at the end of the command we want to execute. Assuming, once again, that the command to execute was cat:
cat file && zenity --info --text = "Long command completed."
Source: Webupd8
In theory this could also work: »cat file && echo -ea«, produces a beep at the end of the command (in chakra it does not work). About the Tip (if I did not misunderstand), "command1; command2" is not the same as "command1 && command2"; In the first case, command2 is executed regardless of whether command1 has finished correctly, in the second it is only executed if command1 finished correctly. Greetings and good post, I liked notify-send, very practical
very useful! testing…
Hello, I usually use this option better:
cat file; zenity –info –text = »Long command completed.» &
This allows me to put more than one notification and the terminal does not lock until I press.
regards