Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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.

share|improve this question

marked as duplicate by Takkat, Aditya, Sylvain Pineau, Florian Diesch, i08in Apr 18 '14 at 14:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 6 down vote accepted

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)
share|improve this answer

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.

share|improve this answer
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

Not the answer you're looking for? Browse other questions tagged or ask your own question.