Kill the process that occupies the specified port and the process that occupies the specified port
When tomcat is started, it fails to be started. If the port is occupied, which program occupies the port?
How can I determine which process (Program) occupies the specified port?
I will describe it on two platforms (windows and linux ).
Run the following command to find the pid (process id) that occupies the specified port)
Netstat-ano | findstr <specified port number>
For example, you can find the process that occupies port 8080.
It indicates that processes with a pid of 1532 occupy port 8080.
Then, open the task manager and find the process,
So how to kill the process?
taskkill /pid 1532 /f
Note: pid is followed by pid.
Run the following command to find the pid (process id) that occupies the specified port)
netstat -aonp |grep ":80[ ]\+"|awk -F" " {'print $0'}
This is the process used to query port 80
The process with pid 11116 occupies port 80.
After optimization:
netstat -aonp |grep "^[a-z]\+[ ]\+0[ ]\+0[ ]\+[0-9\.]\+:80[ ]\+"|awk -F" " {'print $0'}
Let's verify it.
Tomcat occupies port 80.
What if only pid is displayed?
netstat -anp |grep "^[a-z]\+[ ]\+0[ ]\+0[ ]\+[0-9\.]\+:80[ ]\+"|awk -F" " {'print $7'}|cut -d"/" -f1
In linux, how does one kill a process?
kill -9 11116
My technical blog on ITEye:
Http://hw1287789687.iteye.com/