Listing Ports and Active connections w/ Netstat
January 14th, 2010
Who’s connected to my server?
root@donkey:~# netstat -ntla | grep "80"
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.5:80 206.169.197.253:20277 ESTABLISHED
Grep port for host.
root@donkey:~# lsof -i tcp:80 | grep "20277"
apache2 20114 www-data 9u IPv4 9576072 TCP donkey.local:www->206-169-197-253.static.twtelecom.net:20277 (ESTABLISHED)
Kill Connection
kill -9 20114