9

I want to be noticed after a command has finished its execution. And I was thinking that if I hear a sound is a good idea.

For example, because I have a slow internet connection, the following command take long time to execute:

sudo apt-get update && sudo apt-get upgrade

So I let the terminal to run in background running the above command, but I want to hear a sound when it finished.

user270287
  • 93
  • 4

2 Answers2

10

You can combine your command with a command that plays sounds. For example paplay:

sudo apt-get update && sudo apt-get upgrade; paplay /usr/share/sounds/ubuntu/stereo/message.ogg

Furthermore, if you want to play a sound if the command was successfully completed and another sound in case of an error, you can use something like:

command && paplay $(locate dialog-information.ogg) || paplay $(locate dialog-error.ogg)
Radu Rădeanu
  • 169,590
0

Try the below command on terminal,

sudo apt-get update && sudo apt-get upgrade && aplay /path/to/Sound/filename.wav

/path/to/Sound/filename.wav - path to your .wav file.

The sound wiil be played only if both the commands are executed successfully.

Avinash Raj
  • 78,556
  • 2
    Though this will play the sound only if both commands - update & upgrade - were successful. If any of them failed, the sound will not play. – Dan Apr 18 '14 at 11:07