To Find and Kill Process for any given Port:
we use following code :-
C:\WINDOWS\system32>netstat -o -n -a | findstr 8080
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4184
C:\WINDOWS\system32> taskkill /F /PID 4184
SUCCESS: Sent termination signal to the process with PID 4184.
FOR LINUX
we use following code :-
C:\WINDOWS\system32>netstat -o -n -a | findstr 8080
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 4184
C:\WINDOWS\system32> taskkill /F /PID 4184
SUCCESS: Sent termination signal to the process with PID 4184.
FOR LINUX
netstat -plten |grep java
used grep java as tomcat uses java as their processes.
It will show the list of processes with port number and process id
tcp6 0 0 :::8080 :::* LISTEN
1000 30070621 16085/java
the number before /java is a process id. Now use kill command to kill the process
kill -9 16085
-9 implies the process will be killed forcefully.
Comments
Post a Comment