Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 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.

add comment

2 Answers 2

up vote 5 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
add comment

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
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 at 11:07
add comment

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