Let's say I run a command which takes a long time to do its stuff, but I don't want or need to look at it the whole time, and as I need to do some other stuff as well I might get into that and forget to check on how the command is doing for some time... Then when I finally do check I may find that the command finished 3 hours ago and needed my attention then... Or perhaps it didn't need my attention, if I had seen that it had finished at the time I would have had more time to run more commands...
So I was wondering if there is a way to get it so that when a command or program has been run, whenever it finishes and returns to $
, for it to make a little sound, like play an mp3 file or something? Though it would be acceptable just to get this working in gnome-terminal
, I would like it in as many CLI environments as possible including the TTYs if that would be possible... I am running Ubuntu GNOME 15.10 with GNOME 3.18.
First, run the following commands to enable pcspkr
and to install beep
:
sudo sed -i 's/blacklist pcspkr/#blacklist pcspkr/g' /etc/modprobe.d/blacklist.conf
sudo modprobe pcspkr
sudo apt-get install beep
Now, run a command along with beep
like so:
sudo apt-get update; beep
or
sudo apt-get update; beep;beep;beep;beep;beep
Finally, to control the volume of beep
, change the beep
volume from alsamixer
by running the following command:
alsamixer
Now, use your right arrow key to scroll to the automute option. Use the up arrow to toggle this off.
Then use the left arrow key to scroll to beep and use the up or down arrow key to raise or lower the volume of beep.
Use the M key to mute or un-mute any channel.
Press ESC to exit alsamixer
Many more options for beep can be found at:
man beep
EDIT
Now, to get the terminal to beep after each command is run, run the following command:
cp .bashrc .bashbackup
echo 'PROMPT_COMMAND="beep"' | tee -a .bashrc
. .bashrc
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments