Skip to content

Instantly share code, notes, and snippets.

@agusmakmun
Created March 12, 2020 04:52
Show Gist options
  • Save agusmakmun/6c3a988abe82c460df46368d1d92b13a to your computer and use it in GitHub Desktop.
Save agusmakmun/6c3a988abe82c460df46368d1d92b13a to your computer and use it in GitHub Desktop.
How to make a notification when terminal process is complete

I have started a long process through a terminal. Is it possible to make the Ubuntu terminal make a sound once the process is complete? This way, I don’t need to keep checking, but will instead be notified through a sound or another notification.

You can use this some alternatives;

$ your-bash-command && aplay /path/to/sound.wav  # can also with *.ogg file.
$ your-bash-command && paplay /path/to/sound.ogg  # can also with *.wav file.
$ your-bash-command; spd-say "done"
$ your-bash-command && notify-send "done"  # without sound
$ your-bash-command && notify-send "Process completed" "Come back to the terminal, the task is over"

And this script below is modification of that commands above.

  1. Create the notif-me.sh file;
#!/bin/bash

notify-send "Process completed" "Come back to the terminal, the task is over"
spd-say "My lord, your process hasbeen complete."
  1. Make it callable in /bin
sudo cp notif-me.sh /bin/notif-me;
  1. Use it;
$ your-bash-command; notif-me

# or 

$ your-bash-command && notif-me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment