When I start a new X server using vncserver I can connect it using port 5901. From, say, a terminal, I can also do a:

export DISPLAY=:1.0 xterm

(it's just an example)

And I get an xterm on the Xvncserver.

What is the relation between :1.0 and port 5901?

2 Answers 2


Port 5901, generally by convention Port 5900 + XDisplaynumber, is the TCP Port on which the VNC service listens. That's their relation. Actually you may use arbitrary TCP Ports with arbitrary Xdisplaynumbers.

The VNC service is meant to transports input (mouse, keyboard) from the client to the server and output (an image) from the server to the client. This does not need to have anything to with X. For example in virtualization VNC is often used to make the "physical" terminal of a virtual machine remotely accessible.

The X11 System is much more complex than that and programs use it to interact with the Xserver and with each other. In wording in the X world is a little unintuitive at first so the meaning of output, seat, screen, display, server, client need to be learned and deserve some consideration.

To your question: an Xdisplay is the logical core of any X instance. When you start a program that program is a Xclient and connects to the provided display of an Xserver. :1.0 is actually an abreviation and means "display 1 at localhost". You can provide a hostname or IP-address e.g. DISPLAY= to have the program you are about start connect to Xdisplay 3 at the (remote) computer with the given IP-address.

X and VNC are two totally different services implemented for different purposes with different goals. (One may argue that some/most VNC goals were also goals when developing X, but that's rather academic and very in depth.)

When using Xvncserver both concepts are combined back to back. So there is an Xserver with which Xclients communicate "the normal way" but instead of using the hardware available to interact with a user, the Xvncserverit implements a VNC server, to which a VNC client can connect.

  • here unix.stackexchange.com/questions/12777/… they say, that base port is 6000. I don't know what is the reason but 6000 = 0.0 worked for me (instead of 5900 = 0.0).
    – torbatamas
    Nov 9, 2016 at 9:29
  • The difference is VNC. On port 5900+(DisplayNumber) you connect your screen and input, using a VNC viewer. On port 6000+(DisplayNumber) XClients connect to the XServer, which are the programms running "on" X. Those are different protocols with different purposes, as explained in my answer.
    – Bananguin
    Nov 9, 2016 at 11:50

Inherently, none.

When you run the xvncserver it needs to do two things.

  1. Open a listening port (which for VNC is 5901
  2. Create a display target

The display target can be any number. Commonly, logging in on the console via X will use display :0. It doesn't have to, you could log in on the console first and then use startx :36 instead. VNC uses 1.0 by default because it's probably the first available display.

These two are chosen by convention, there's no magic that binds them together except the running process attached to both.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .