You can use the lsof
command to find out which ports are open on a Linux system:
lsof -i
This will display a list of all open Internet sockets and the processes that have opened them. The -i
option is used to specify that you only want to display information about Internet sockets.
You can also filter the output to only display information about a specific protocol or port number. For example, to only display information about open TCP ports:
lsof -i TCP
To only display information about a specific port number, such as 80 (HTTP):
lsof -i :80
Note that the lsof
command requires root privileges to run, so you may need to run it using sudo
.