PORT IN USE

When you try to start a service or application like Web Server (IIS , Tomcat, etc..) the service response can response with an Error Loke: “The Port is already in use”

How can you find what use this port and how to kill the process that use it ?

Window :
In windows netstat is used to Displays protocol statistics and current TCP/IP network connections.

You Just find the process which is using the port number. Lets assume the process number is 7881. Then use taskkill command to forcefully (/F parameter) terminate that process.

  • netstat -ano | find “8081”
  • taskkill /F /PID 7881

***on find command the port number should be between ” “.

Linux :
Similarly in Linux we can use netstat command to find the process. In linux netstat is used to show network status and grep command is used to find the particular port out of it as shown below. Then use kill command (using -9 For “Force” kill) to terminate the process.

  • netstat -an | grep “8081”
  • kill -9 7881

*** the stronger signal 9, called SIGKILL, should be used for force killing of process

SHMUEL H.

Leave a Reply

Discover more from Rafael IT Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading