In the server operation and maintenance, we will use some ports that are occupied, and then we need to check and troubleshoot them. Here in Linux system, we can generally use the netstat command to check whether the port is occupied. Use the following command:
Netstat - an | grep port number
Among them, the - a option indicates that all connection and listening ports are displayed, the - n option indicates that the port number is displayed in numerical form, and the grep command is used to filter the results and display only the specified port number.
For example, if you want to check whether port 80 is occupied, you can run the following command:
netstat -an | grep 80
If port 80 is already occupied, the IP address and status information associated with the port will be displayed. If the port is not occupied, there will be no output.
Scan the code to follow the official account
Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge