Is there a more graceful way of listing vncserver sessions than just getting the list of running PIDs?

118,147

Solution 1

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

Solution 2

ps -ef | grep `whoami` | grep vnc
Share:
118,147

Related videos on Youtube

Jess
Author by

Jess

Updated on September 18, 2022

Comments

  • Jess
    Jess over 1 year

    How do you list your vncserver sessions?

    This article says to do this:

    $ cat ~/.vnc/*.pid
    5910
    6790
    16589
    21891
    ... 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.

    • Admin
      Admin about 7 years
      Have you tried vncserver -list?
    • Admin
      Admin about 7 years
      I don't see a -list option in the man page.
    • Admin
      Admin about 7 years
      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).
    • Admin
      Admin almost 7 years
      You could post a suggestion to the VNC project ! If you don't, I will .... eventually ;-)
    • Admin
      Admin over 2 years
      @MikeW did that ever happen?
  • Jess
    Jess about 11 years
    I have 6 sessions listed. The only session I can get to is :6. How would I know which sessions are active/still working?
  • DavidPostill
    DavidPostill over 3 years
    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.