Let's use sudo apt-get install linux as an example.

Here is the notify send command: notify-send -i terminal Bash "execution complete"

How could I substitute 'bash' with the entire sudo command? Where the command appears in bold as the title as "execution complete" displays below it as a message. This would be used as a means of notification. Once a command finishes, a notification appears displaying the message.

Others have used ";alert" to utilize notify-send. notify-send -i terminal Bash "execution complete" is saved as an alias as 'alert,' I'd like to add to this alias for the sake of convenience.

  • UPDATE: I've used the following two alias to do what was posted however it requires that I add ";alert" after every command. However I am in search of a method to avoid this. These two lines were written by another person. They've been manipulated to suit by needs. alias alert_helper='history|tail -n1|sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*aler$ alias alert='notify-send -i terminal "$(alert_helper)" "execution complete"'
    – atlaspaine
    Nov 14, 2014 at 4:02

2 Answers 2


You format text with html code

notify-send -i terminal "<font size=16 color=blue><b><i>'bash -c ls'</b></i></font>"  "execution complete"

change what is in the single quotes with the command you wish, feel free to change the size and color to what you wish.

If you need assistance, post your code and more detailed information on what you wish to change

  • 4
    The HTML code does not get parsed in my version notify-osd 0.9.35+15.04.2015
    – mxmlnkn
    Feb 20, 2017 at 22:08
  • @mxmlnkn - Rather then commenting here please either ask a new question or file a bug report. You would have to post your code if you need help.
    – Panther
    Feb 22, 2017 at 16:49
  • doesnt work at all
    – alexzander
    Jun 28, 2022 at 12:48

Install and use libnotify-bin:

sudo apt install libnotify-bin

To run notify-send if the command ended successfully:

sudo apt install something && notify-send -i terminal "Last command" "ended successfully"

To run it either way, use ; instead. To do something like what @Panther answer:

notify-send -i terminal "$(bash -c ls -l | tail -1)" "execution complete"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .