Friday, May 8, 2015

Linux grep all running processes for a given port and kill them

Open a terminal and type the command:
  • netstat -anp | grep 8080
Replace 8080 with your desired port.

You will get a result like below
  • tcp6     0     0 :::8080      :::*     LISTEN      6903/java 
The 6903 is your process id.

Optionally if you want to kill this process, type the command
  • kill -9 6903

No comments:

Post a Comment