How to check whether a port is open in Linux: 1. Use the lsof command, which can list the files opened by the system. The syntax is "lsof -i:port number"; 2. Use "netstat -aptn " command, this command can view all open port numbers.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
First we open the Linux command interface to check the port. In order to obtain higher permissions, switch to root user login
The first method is to use the lsof -i:port number command line, taking 80 as an example,
If there is no output, it means that the port number is not enabled. In order to facilitate testing, I detect an open port number here, and the information shown in the figure will be output
The second method is to use the netstat -aptn command line to view All open port numbers,
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to check if a certain port is open in Linux. For more information, please follow other related articles on the PHP Chinese website!