Friday, June 3, 2011

Ports

This is my cheat sheet to view Linux ports.
http://www.cyberciti.biz/faq/how-do-i-find-out-what-ports-are-listeningopen-on-my-linuxfreebsd-server/

netstat command to find open ports
# netstat --listen

To display open ports and established TCP connections, enter:
$ netstat -vatn

To display only open UDP ports try the following command:
$ netstat -vaun

If you want to see FQDN (full dns hostname), try removing the -n flag:
$ netstat -vat

To display the list of open ports, enter:
# lsof -i

To display all open files, use:
# lsof

To display all open IPv4 network files in use by the process whose PID is 9255, use:
# lsof -i 4 -a -p 9255

No comments: