DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Start GUI Application on Another Screen


  1. On host A, start up a desktop environment like gnome or window manager like i3, start a terminal, run echo $DISPLAY, then you get the display number of this screen, like ":0".

  2. Open a terminal on host B and ssh to the previous one, run following command:

    $ export DISPLAY=:0 $ gvim

Then you can see the gvim open in the screen of the host A.

  1. In most cases the remote display is ":10". So on host A, if you set DISPLAY as ":10", you will display a GUI window on the screen of host B.

Running the codes below on host A, you can find the display number of hosts ssh to it:

netstat -lnt | awk '
  sub(/.*:/,"",$4) && $4 >= 6000 && $4 < 6100 {
    print ($1 == "tcp6" ? "ip6-localhost:" : "localhost:") ($4 - 6000)
  }'

For example:

localhost:10 ip6-localhost:10

means the remote display is ":10".

Ref:

http://askubuntu.com/questions/47642/how-to-start-a-a-gui-software-on-a-remote-linux-pc-via-ssh

http://unix.stackexchange.com/questions/17255/is-there-a-command-to-list-all-open-displays-on-a-machine



Published

May 4, 2014

Last Updated

May 4, 2014

Category

Tech

Tags

  • Dispaly 1
  • GUI 9
  • Linux 158

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor