When I ssh
to a server using -X
, I am always confused about which display number I should export. It seems to me sometimes the display number has been used by something, so what I can do is only go through:
export DISPLAY=localhost:0 && xclock
export DISPLAY=localhost:1 && xclock
export DISPLAY=localhost:2 && xclock
export DISPLAY=localhost:...
until the clock appears. I will then use that display number. Each time I log into the server, the display number which is able to tunnel the GUI data correctly would be different.