How to play a sound after a command has finished its execution?

How to play a sound after a command has finished its execution?

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

  • Answer:

    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)

user270287 at Ask Ubuntu Visit the source

Was this solution helpful to you?

Other answers

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

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.