Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working in a multi-workspace multi-window configuration. I am constantly running scripts behind the scenes.

It would save me a lot of time and context switching if I could kick off a script on another server and have a message popup (growl notify or w/e) on my desktop letting me know that the command finished.

Is there a way to do that in Ubuntu 10?

share|improve this question

Here's one way to do it, assuming you have password-less SSH set up:

ssh my-graphical-workstation 'env DISPLAY=$(w -s $USER | grep -m 1 " :" | awk "{print \$3}") notify-send "Done processing."'

You'll need libnotify-bin Install libnotify-bin installed on my-graphical-workstation.

Adjust it as necessary.

share|improve this answer
Why not simply use ssh server command && notify-send "Done processing.", run (of course) from the workstation where the notification should go? – loevborg Jun 8 '11 at 18:39
@loevborg This can be integrated into scripts that reside on the remote machine, does not require the SSH connection to be maintained while the job is processing, and is convenient to use from within GNU Screen. – ændrük Jun 8 '11 at 20:17
this sounds great! Except I am not getting popups. Libnotify is of course installed. I rummaged in my system settings to try and get an event source configured, but I didn't see any "notify-send" or "read stuff from CLI" source. – Paul Nathan Jun 8 '11 at 21:36
@Paul To troubleshoot, first confirm that notifications appear when you run just notify-send "Done processing." on the graphical workstation. Then, on the remote machine, check what happens if you use echo env in place of env in the full SSH command. You should see output that's similar to env DISPLAY=:0.0 notify-send Done processing. Confirm that the value of DISPLAY in that output matches one of the values in the FROM column of w -s on the graphical workstation. – ændrük Jun 8 '11 at 22:39
Yeah, my workstation doesn't show it. :-/ – Paul Nathan Jun 8 '11 at 22:41

To augment the fine answer by @ændrük:

you might need to allow the connection from the remote machine. At the simplest, use

xhost +

but you should restrict this to the target machine once working, if you do not want the whole world to open X11 windows on your machine. This is done automatically if you do ssh -X, but needs to be added manually if the ssh connection is not maintained.

If you are always connected, just add a -X to your ssh parameter to have it do the setup for you, as in

user@localhost:path$ ssh -X where_the_script_is_run
user@where_the_script_is_run:path$ run-script; xmessage 'whatever message'

notify-send did not work for me remotely. You can use the (archaic) xmessage program.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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