I am looking for a way to list all the active VNC connection to a machine.
I know I can get all the active connection of the machine by running netstat -na but I don't know how to filter just the connection for the VNC server.
I am running OSX 10.8.3 , any hint?
Asked
Active
Viewed 1.3k times
1
nick2k3
- 255
2 Answers
2
VNC runs on port 5900 by default, so you should be able to do:
netstat -na | grep '[:.]5900'
(OS X uses . as a port delimiter, but on Linux it's : — the pattern above will match both)
Example on my OS X machine:
% netstat -na | grep '[:.]5900'
tcp4 0 0 *.5900 *.* LISTEN
tcp6 0 0 *.5900 *.* LISTEN
kine
- 1,849
1
If you are running xrdp to connect to vnc, then 5900 will not show all the connections. Here is a slightly different answer:
netstat -na | grep '[:.]5900'
gives:
tcp 0 0 127.0.0.1:5918 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5919 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5913 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5914 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5915 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5916 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5917 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:5913 127.0.0.1:54546 ESTABLISHED
tcp 0 0 127.0.0.1:54546 127.0.0.1:5913 ESTABLISHED
Also see this answer for how to dig the port out of the process.
steampowered
- 2,737