Home Command line utilities Get Notification When A Terminal Task Is Done

Get Notification When A Terminal Task Is Done

By sk
Published: Last Updated on 2.9K views

I prefer CLI mode over GUI to do most of the tasks in my Linux box, and I am sure most of you will do as well. When I run a command that takes long time to complete, I check the Terminal constantly to make sure whether the task is completed or not. Say for example, when I update my Arch system, I keep checking the Terminal to know whether the given task is completed or not. Not anymore! Today, I have stumbled upon an useful script called NotiFyre that notifies you with a pop up window when a Terminal activity is done.

I tested it in Ubuntu 16.04 LTS desktop and works good as described below.

Get Notification When A Terminal Task Is Done Using NotiFyre

Make sure you have installed the following prerequisites.

$ sudo apt-get install notify-osd pulseaudio-utils libnotify-bin

Generally, these prerequisites will be installed by default on most Linux distributions. To check whether if notify-osd is working or not by running the following command from your Terminal.

notify-send "hello"

The above command will open up a pop window that displays a message "hello". If no message pops up, it means notify-osd is not working. Try to reinstall the above prerequisites as shown below.

$ sudo apt-get --reinstall install libnotify-bin notify-osd

Now run the notify-send command and see if the message pops up.

Next, download or git clone the NotiFyre script from its GitHub page. The link is attached at the end of this guide.

Then, open the NotiFyre folder. Copy the following files and place them in your HOME folder if you use BASH shell.

  • bash-preexec.sh
  • notifyre.sh
  • terminal.png

Then, edit bashrc file:

$ sudo vi ~/.bashrc

Add the following lines at the end.

source ~/notifyre.sh
source ~/bash-preexec.sh

Save and close the file. Then, run the following command to take effect the saved changes.

$ source ~/.bashrc

Now, run any task on your Terminal, you will be notified each time when a command is completed.

Cool, isn't it?

Also check this similar tool:

If you use Fish shell, you need to place the terminal.pngprompt_pwd.fish, notifyre.fish and nf.fish files in your ~/.config/fish/functions/ folder. Then edit your functions/fish_prompt.fish file and add the following lines just before the end.

function fish_prompt

    eval (notifyre)  

You can change the notification sound (tone) by editing this line in the notifyre.sh file.


Also, you can change notification interval time by editing the following line in notifyre.sh file.

[ $(($(date +%s) - start)) -le 0 ] || notify-send "Terminal process" "$(echo $@) completed in $(($(date +%s) - start)) seconds" -i ~/terminal.png -t 2000

Now, you don't have to constantly check the Terminal to know whether a task is finished or not. Just run and forget about the long running terminal task. NotiFyre will take care of it and notify you once task is done.

And, that's all. Hope this was useful. More good stuffs to come. Stay tuned!



Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More