Linux Tutorials

How To List Open Ports On Linux?

How To List Open Ports On Linux?
Written by itsubuntu

Check out how to list open ports on Linux.

There are multiple ways to check the open ports on Linux.

How To List Open Ports On Linux?

List open ports On Linux using netstat

Netstat is used to display the current status of TCP and UDP conversations. you can list the open ports on Linux using netstat. Run the following netstat command to see the open ports on Linux.

Run the following command to list all listening ports, using both TCP and UDP:

netstat -a

Run the following command to list only UDP port connections:

netstat -au

Run the following command to list all actively listening ports, use the following command:

netstat -l

List open ports on Linux using ss command

Run the following command to list the open ports, run the following command:

ss

Run the following command to list listening and non-listening ports:

ss -a

Run the following command to display listening sockets only:

ss -l

Run the following command to display all TCP connections:

ss -t

Run the following command to have a view of all the listening TCP socket connections use the -lt the combination as shown.

$ ss -lt

Run the following command to view, all the UDP socket connections use the -ua option as shown.

$ ss -ua


Run the following command to list listening UDP connections use the -lu option.

$ ss -lu

Listening ports and applications using lsof command.

Run the following command to check open TCP and UDP ports using the lsof command:

$ lsof -i -P -n | grep LISTEN

 

About the author

itsubuntu

Leave a Comment