I have started a long process through a terminal. Is it possible to make the Ubuntu terminal make a sound once the process is complete? This way, I don’t need to keep checking, but will instead be notified through a sound.
There are at least three command line ways to accomplish this by putting the suiting command at the end of your script you may invoke for your lengthy process:
We can use default sound files from
Just to have mentioned it, there is another nice way to achieve this by misusing espeak, which is installed by default in Ubuntu <= 12.04. See, or rather hear the following example:
In Ubuntu >= 12.10 Orca uses speak-dispatcher. We can then install espeak , or alternatively use
Replace "make" with whatever long-running command you use.
To play a sound after command finishes:
Or read below for more options:
Different sound on error and success
Here is what I use for exactly what you ask for - with one difference: it not only plays a sound when the command finishes but it plays a different sound on success and on error. (But you can change it if you don't like it.)
I have a Bash function called
It plays a sound and displays OK or ERROR (with error code) when the previous command finishes.
Here is that function with two helpers:
You can put it in your ~/.bashrc directly or put it in some other file and then put this line in your ~/.bashrc:
You can experiment with
To find some good sounds on your system you can try:
Here are some sounds that I often use that are available on Ubuntu by default that are good for notifications - sn1 is loud and nice, sn2 is very loud and still pretty nice, sn3 is extremely loud and not so nice:
Again, you can change
And just in case this is the same function as
Here is how you use it:
Example with success:
example with error:
Of course in practice the commands are more like:
but I used
You can use
Or you can use e.g.:
to print OK/ERROR but always play the same sound, etc.
I put those functions on GitHub, see:
The source can be downloaded from: