How do you list your vncserver sessions?

This article says to do this:

$ cat ~/.vnc/*.pid
... and many more

Using this method, I could write a script to check each pid, but there has got to be something better.

Is there a better way? I'd like to see something like:

$ vncserver -l
Session  User  Started     Status    Blah
1        jess  3/24 19:00  Active    ?
2        jess  3/21 14:00  Suspended ?

EDIT: For example. I have six sessions running, but I can only use one of them. All six show up as running processes. It would also be nice to see a list for other users too; I just found a server with 95 VNC sessions. I have no idea which ones are active.

  • 2
    Have you tried vncserver -list? – Roman Luštrik Mar 13 '17 at 12:00
  • I don't see a -list option in the man page. – Jess Mar 13 '17 at 12:28
  • 1
    Doesn't work for me on tightvncserver 1.3.9-6.4ubuntu1, but works on CentOS 7 (I'm guessing I have tigervnc-1.3.1-9.el7.x86_64.rpm). – Roman Luštrik Mar 14 '17 at 12:00
  • 2
    You could post a suggestion to the VNC project ! If you don't, I will .... eventually ;-) – MikeW Jul 23 '17 at 8:04

I always use ps -ef | grep vnc, then pick out the parts I need from that.

  • 2
    I have 6 sessions listed. The only session I can get to is :6. How would I know which sessions are active/still working? – Jess Mar 27 '13 at 12:33
ps -ef | grep `whoami` | grep vnc
  • 1
    Welcome to Super User! Could you please edit your answer to give an explanation of why this code answers the question? Code-only answers are discouraged, because they don't teach the solution. – DavidPostill Sep 22 '20 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.