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

Sometimes I need to start XMBC media player or other GUI software a one of my PC (small Xubuntu PC used as a media center).

Usually I do this starting a X11vnc server on the remote PC via SSH and than connecting with an Xvnc client to the Xfce desktop.

Is there a way to start a GUI software on a remote Linux PC via SSH?


share|improve this question
up vote 71 down vote accepted

Yes. You just need to run export DISPLAY=:0 (or whatever the remote display is numbered as) in your ssh session and programs run will run on the remote display. A quick example:

oli@bert:~$ ssh tim
oli@tim:~$ export DISPLAY=:0
oli@tim:~$ firefox

Firefox is now running on tim's display.

However when you close your ssh session, most of the time the remote application will close. If you want to disconnect from ssh but leave the application running you need to launch it in a special way using something like screen (keeps the ssh session running in the background) or nohup, or another method. For more information on this there was recently another question on it.

You can shorten this all down into one command that will connect, export the display in-line and start the application in a way that won't close it after the ssh session dies:

ssh tim "DISPLAY=:0 nohup firefox"
share|improve this answer
It said No DISPLAY: this may not be what you want. when i tried it (I tried it from abiword by the way. ` – PyRulez Nov 29 '14 at 17:14
@PyRulez Note the "or whatever the remote display is numbered as" in the first line. If it's not the first graphical server it might be :1 or higher. Run w to see who's logged in and where. That will tell you the DISPLAY number too. – Oli Nov 29 '14 at 17:20
I do have a display 0, and it is the only display and it is physically on and working. – PyRulez Nov 29 '14 at 17:26
How do I turn it back off – akabhirav Mar 16 at 6:42
sometimes you want to do the opposite and run the X app locally just connect using -Y and then run your app ssh -Y <remoteip> – Postadelmaga Mar 27 at 15:08

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.