Home  >  Article  >  Operation and Maintenance  >  How to close a port in linux

How to close a port in linux

WBOY
WBOYOriginal
2022-01-06 10:04:2165525browse

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.

How to close a port in linux

#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.

How to close a port in linux

Find the process corresponding to the port you want to close,

How to close a port in linux

Enter the kill -9 port number command to close it process and port.

How to close a port in linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn