1

From https://unix.stackexchange.com/a/17278/674

Local displays correspond to a socket in /tmp/.X11-unix.

(cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done)

On a computer:

$ (cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done)
:0
:1
:10
:11
:2
:3
:4
:5
:6
:7
:8
:9

I was wondering how to find out the X servers (command, or pid) for the given display numbers?

Thanks.

Tim
  • 101,790

1 Answers1

2
lsof /tmp/.X11-unix/X*

as root will list the commands and pids corresponding to each socket. You can then match the socket name to the display number, as you’ve done in your example.

Stephen Kitt
  • 434,908