This article was written so one can figure out what process is listening on a port. I’m going to list how to find out what process is running on a windows port and how to find out what process is running on a unix or linux port.
First lets look at the windows operating system and how to find out what process is using what port.
Open your command prompt and type in netstat -ano this will list all processes ID and what port it is running or listening on. To open the command prompt click start -> run -> cmd and hit enter. This will open the command prompt. netstat -ano will output as seen below
Find the port you’re inquiying about and take note of the PID. Now that you have the PID number (located to the left side of the command prompt) you can open up the task manager to tie that PID to a process / program.
Just hit control + alt + del then click task manager or you can right click the bottom task bar and select task manager from the list. Once task manager is open you’ll need to tell it to display the PID. To do this open task manger and click -> view -> select columns -> and select PID
Now you can see the PID and the corresponding program / process associated with it.
Finished with windows.. on to UNIX!
How to determine what process is listening on a port in Unix is so much easier.
Let’s say we want to find our what process is tied to port 53.
First, use the following command to find if the port is is use or not
netstat -an | grep 53
#Then, use the following command to find which process is using the port
fuser -n tcp 53
This will return something like ’53/tcp: 5006′.
it shows pid.
After that, we can find the full process information.
ps -ef | grep 9113
If you know shell you can use the below in a shell script to put all these step together
status=`netstat -an |grep $1`
if [ “$status” == “” ]; then
echo “port $1 is free”
ps -ef |grep `fuser -n tcp $1`
Or if you’re running linux download lsof
lsof -i :53
lsof -i :1226
Or you and use grep
lsof | grep [process name]