UNIX/Linux: Stop a VNC Server

Execute this command at your UNIX or Linux session:

# vncserver -kill :<display>

This kills a VNC desktop previously started with vncserver. It does this by killing the Xvnc process, whose process ID is stored in the file “$HOME/.vnc/host:display#.pid”. It actually ignores anything preceding a “:” in its argument. This can be useful so you can write “vncserver -kill $DISPLAY”, for example at the end of your xstartup file after a particular application exits.

You May Also Like

1 Comment

  1. Thanks! Very useful piece of information that for some reason eluded me for a while. Apparently you can’t just “kill $PID” from the cli because vncserver keeps bouncing it back…

Leave a Reply?