Linux find out which port is open using the command line

‮ptth‬s://www.lautturi.com
Linux find out which port is open using the command line

There are several ways to find out which ports are open on a Linux system using the command line. Here are a few options:

  1. netstat command: The netstat command can be used to list all open ports on a Linux system. Use the -tulpn options to display the TCP, UDP, and listening ports. For example:
$ netstat -tulpn
  1. lsof command: The lsof (List Open Files) command can be used to display a list of all open network sockets on a Linux system. To list all open TCP and UDP ports, use the -i option followed by the protocol (TCP or UDP). For example:
$ lsof -i TCP
$ lsof -i UDP
  1. ss command: The ss command is another utility that can be used to list all open sockets on a Linux system. To list all open TCP and UDP ports, use the -t and -u options respectively. For example:
$ ss -t
$ ss -u

You can also use the grep command to filter the output of these commands to find a specific port. For example, to find if port 80 is open, you can use the following command:

$ netstat -tulpn | grep :80
Created Time:2017-10-30 10:17:40  Author:lautturi