Sometimes, when I execute a long command on my computer, I suffix it with && notify-send "It's finally done!". Is there any way I could do this from an ssh session? I'm aware I could do a one line ssh, e.g. ssh remotehost "long-term-command" && notify-send "It's finally done!, but I'd rather not as I'm executing many long-term commands and this seems clunky and inefficient.

If I wanted to notify-send on the remote system, I'd set DISPLAY to :0. Is there something similar I could do for the opposite?


X11 Forwarding? Then, run $ long-command && notify-send "finished" from the server, w hich should be displayed on the client.


Pipe the command into batch or at now.

batch <<< "ssh remotehost long-term-command && notify-send 'It is finally done!'"

Beware of the quote characters and the enviroment of the shell. Take a look at atq and atrm to control the queue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.