Ubuntu/Debian Notification After Command Has Run

If you’re about to run a process that is going to take a considerable amount of time to execute, it is convenient to have that process run without your supervision. And having some type of notification as to when the process has finished executing… or throwing an error, is a big help. Luckily in Ubuntu, and most command line interfaces, there is a way to be notified visually and audibly when a command has finished running.

The following command example shows the two commands that can follow any command to send a notification to the screen as well as say “All Done”. notify-send sends the visual notification. Adding the flag -u critical means the notification will not fade away until it is clicked. The default setting for notify-send is to have the notification fade-away. spd-say command will say whatever you type in quotes after. Using the semi-colon following commands will make sure the execute even if the preceding command fails.

find / -name *.txt; notify-send -u critical “All Done”; spd-say “All Done”

Already have the command running, but need to add notifications?
Hit CRTL + z, which will pause the foreground running process. Then type the following command sequence:

fg; notify-send -u critical “All Done”; spd-say “All Done”

fg will restart the paused foreground process, CTRL + z created.