Home > Article > Operation and Maintenance > How to check whether a specified port is open in Linux
First we open the command operation interface of Linux where we want to view the port, as shown in the figure (taking Ubuntu system as an example)
Then in order to obtain higher permissions (view all ports), switch to root user login here
The first method is to use lsof -i:port No. command line, taking 80 as an example, as shown in the figure:
Recommended related video tutorials: linux video tutorial
If there is no output, it means that the port number is not enabled. To facilitate testing, I will detect an open port number here, and the information as shown in the figure will be output
The second method is to use the netstat -aptn
command line to view all open port numbers.
The command shown in the picture is to view all open port numbers in the system. Port number using udp protocol
Then this command is to view the port number information using tcp protocol in the system
Recommended related articles and tutorials: linux tutorial
The above is the detailed content of How to check whether a specified port is open in Linux. For more information, please follow other related articles on the PHP Chinese website!