How do I find open ports on Linux server?

There are different commands on both Linux and UNIX server to find out what tcp/udp ports are listening or open on your own server. You can use netstat command, which print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships etc. Another (and suggested) option is to use lsof command, which list open files, and ports on Linux, FreeBSD, Solaris and other Unixish systems.

netstat command to find open ports

# netstat --listenDisplay open ports and established TCP connections:$ netstat -vatnFor UDP port try following command:$ netstat -vaunIf you want to see FQDN, remove -n flag:$ netstat -vat

lsof Command Examples

Display list of open ports
# lsof -iTo display all open files, use:# lsofTo display all open IPv4 network files in use by the process whose PID is 9255, use:
# lsof -i 4 -a -p 9255

No comments:

Post a Comment