Check the port occupancy under centos and kill the process

Sometimes we know that a service port is running in the background and want to close it. For example, my tomcat is port 8080, running in the background. How to turn it off?

  • View the pid of this process according to the port
netstat -lnp|grep 8080 #8080 Please change to the port required by your apache
  • View process details
ps 1777 #1777 is the pid obtained in the previous step
  • kill process
For example: kill -9 [PID] #-9 means to force the process to stop immediately

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325218857&siteId=291194637