Home >Operation and Maintenance >Linux Operation and Maintenance >How to close a port in linux
How to close the port in Linux: 1. Use the "netstat -anp |grep port" command to find out the process occupying this port and obtain the process number of the process; 2. Use "kill -9 process number" Command, close the process corresponding to the port to close the port.
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
How to close the port in Linux
The first step is to use the following command
netstat -anp |grep port
Find out the process occupying this port,
The second step is to use the following command
kill -9 PID
Just kill it
An example is as follows:
Enter the command netstat -anp | grep ssh to view the process of opening the port.
Find the process corresponding to the port you want to close,
Enter the kill -9 port number command to close it process and port.
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of How to close a port in linux. For more information, please follow other related articles on the PHP Chinese website!