Start a GUI Application on a Remote Computer using SSH

This article describes how to log into the remote computer (server) using SSH and run a GUI (graphical) application that requires screen. The GUI program will be displayed on the physical monitor, connected to that remote machine.

Run a GUI Program on a Remote Computer’s Screen

The Basic Procedure

Log into a remote machine using SSH:

$ ssh 192.168.1.100

Tell GUI applications to be launched on the local screen (so, any graphical program that you run, will be displayed on the remote computer’s screen):

$ export DISPLAY=:0

Execute GUI Program. For, example lets start Firefox browser that will be launched and displayed on the remote machine’s screen in which we logged in:

$ firefox "www.shellhacks.com"

Use nohup to prevent a process from being stopped after closing SSH session:

$ nohup firefox "www.shellhacks.com"

More Examples

Send a pop-up notification (notify-send) that will be shown on the remote computer’s screen:

$ ssh 192.168.0.100 'DISPLAY=:0 nohup notify-send "Hello" "World"'

Start a music player (rhythmbox) on the remote computer:

$ ssh 192.168.0.100 'DISPLAY=:0 nohup rhythmbox ./Smoke-on-the-Water.mp3'

6 Replies to “Start a GUI Application on a Remote Computer using SSH”

  1. thank you so much.

    you have no idea how many google results I have scrambled through that suggest using X11 forwarding. Holy crap, I don’t want that! Finally you helped me.

  2. I’ve always wondered how to do this… Thanks for the tip!
    PS – Any idea why ‘startx’ doesn’t seem to work using this method?

  3. a little time ago I have been searched this thing but I didn’t find at the time. I found it right now and I’m adding this link to my bookmarks

  4. thanks so much for this, it helped me alot

  5. Linux is so convoluted and esoteric few users attempt to understand its full capabilities; You may place me within this group. However, of late, I have reached out and connected with more astute Linux users, such as yourself. Cool the way your website come up, when Firefox opened on my wife’s Linux. Thank you for an understandable approach. Hope to have fun with its possibilities 🙂 Bookmarked shellhacks.com.

  6. nice work thank you learnd ssh in less than 1 minute

Leave a Reply