Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Why would you use VNC (or for that matter NX) instead of just using ssh -X (-Y). I read that VNC uses less bandwidth, but is there any other differences/advantages with respective tool?

share|improve this question
up vote 18 down vote accepted

Aside from bandwidth and latency issues (which can vary a bit), the big differences are the functionality it provides.

VNC exports a whole session, desktop and all, while ssh will run a single program and show its windows on your workstation.

The VNC server exports a session that survives even when you disconnect your screen, and you can reconnect to it later with all the windows open etc. This is not possible with an ssh X tunnel, since when your X server dies, the windows go away.

share|improve this answer
That's the biggest reason I always use VNC, never direct X window. (I use VNC over a ssh tunnel). When I close the lid on my laptop, the connection is broken. With ssh -X, there is no way to resume -- I have to re-start the application from the beginning. With VNC (both direct and over a ssh tunnel), I can reconnect and continue right where I left off. – David Cary Sep 14 '10 at 17:06
Although a bit OT (since this Q is presumably only about GUI apps): if an actual GUI app is not required, and just basic shell access will do (e.g., xterm), then do "ssh" followed by "screen bash". If disconnected (laptop closed,vpn disconnected, etc), the remote shell stays active. Re-login & re-connect via "screen -r". I only bring this up since I've seen people run vnc just for basic shell access (or run a remote xterm displayed locally); most of the time (but of course not always), simple shell access will suffice. – michael_n Nov 16 '12 at 11:38
@michael_n I am interested to this thing you say about screen bash, but I am not able to make it work. I typed 'ssh -X -t myusername@remotehost screen bash' and after the connection drops I type 'screen -r', but it says 'there is no screen to be resumed'. what should I do? – simona Nov 21 '12 at 12:34
@simona after the successful ssh login, then run screen: ssh user@host ; and after logged in: screen bash ; to disconnect, ctrl+a followed by ctrl+d. You can logout and login again, then: screen -ls and screen -r. Exiting bash exits the screen session. For more (much more), see various tutorials on GNU screen – michael_n Nov 29 '12 at 9:25

ssh -X redirects X11 commands to your local X server. So it is as if you were running the program locally, when it's really running on the computer at the other end. It's very slow because it uses a great deal of bandwidth. (This is what people are talking about when they say X11 is "network transparent.")

VNC and other remote desktop apps instead let the other computer process all of the graphics drawing and so forth and captures, in essence, a screenshot and sends that back to your computer. It can seem much faster, because far less information is required to display everything. However, it also sends the whole desktop, rather than a single application.

I don't recommend using ssh -X over the Internet for one simple reason: It will use all of your available bandwidth. It's fairly useful over a LAN, in my opinion, so if you just need one application and don't want to have to run a whole desktop, this is a good way to go. Otherwise, just use VNC.

share|improve this answer
"It's very slow because it uses a great deal of bandwidth. The X11 protocol is very complex and often involves sending large pixmaps back and forth across the connection." - this is wrong, the X11 protocol isn't very complex and it doesn't involve sending large pixmaps back and forth across the connection. Come and join this proposal to learn more about the X Window System: area51.stackexchange.com/proposals/20129/the-x-window-system – delete Sep 13 '10 at 4:09
@Sherlock: Well, the fact remains that it uses a lot of bandwidth. I deleted the offending sentence. – greyfade Sep 13 '10 at 4:19
NX is an efficient way to transmit X11 protocol data over the network. It compresses the data, provides extensive caching and tunnels sessions over SSH. – Adam Byrtek Sep 15 '10 at 16:43

VNC will share an entire desktop from a remote system. It requires a full-fledged desktop on the remote system.

ssh -X allows you to run single X application from a remote server. The remote system does not need to be running a complete desktop, and you often only need a handful of packages to be installed on the remote system.

ssh -X can be useful when installing complex software packages over a remote connection. Some software products may use a GUI installer (Oracle Database, etc). I don't want to install and a full-fledged Gnome desktop on my remote server. So, you install one or two X11 packages (Xauth?) on the remote server, and allow the DBA to run the Oracle installer remotely using something simple like 'ssh -X /media/cdrom/oracle-installer'.

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.