Vous êtes sur la page 1sur 8

How can you find out which process is

listening on a port on Windows?

How can you find out which process is listening on a port on


Windows?
windows networking port
up vote 316 down vote
favorite
84

edited Jan 17 '13 at asked Sep 7 '08 at


5:46 6:26
shareimprove this
question
Vadzim Readonly
5,11221847 56k70153182
add a comment

13 Answers
active oldest votes
C:\> netstat -a -b

(add -n to stop it trying to resolve hostnames, which will make it a lot faster)
Edit: +1 for Dane's recommendation for TCPView. Looks very useful!
-a Displays all connections and listening ports.
-b Displays the executable involved in creating each connection or listening port. In
up vote 382
some cases well-known executables host multiple independent components, and in
down vote
these cases the sequence of components involved in creating the connection or
accepted
listening port is displayed. In this case the executable name is in [] at the bottom, on
top is the component it called, and so forth until TCP/IP was reached. Note that this
option can be time-consuming and will fail unless you have sufficient permissions.
-n Displays addresses and port numbers in numerical form.
shareimprove this answer edited Nov 14 '13 at 7:56 answered Sep 7 '08 at 6:28

Community
Brad Wilson
1
25.1k45170
45 -o to get the PID Laurent K Jul 10 '12 at 8:03
and taskkill /PID <pid> to then terminate the process, using /F if appropriate.
20
BitMask777 Mar 4 '13 at 20:03
You may have to run your command line shell as administrator, otherwise you
may get an error message about insufficient privileges. Use the "Run as
7
administrator" option when right-clicking cmd.exe. Gruber Jul 29 '14 at
11:20
When doing this in cmd prompt, I'm getting a message as The requested
operation requires elevation. Please help me KingFeming Oct 28 '14 at 6:31
KingFeming: Gruber's comment above applies to you. Brad Wilson Oct 28
1
'14 at 14:20
add a comment

up There's a native GUI for Windows:


vot
e Start>>All Programs>>Accessories>>System Tools>>Resource Monitor (or Run
159 resmon.exe)
do
wn
vot
e

answered May 18 '14 at 5:02


shareimprove this answer

edited Jun 8 '14 at 15:57


bcorso
4,5481921

16

This should be the accepted answer. data Jun 26 '14 at 9:34


Also shows the binding's firewall status (last column). Very util. Raphael Jul 2 '14 at
3
17:34
add a comment
Use TCPView if you want a GUI for this. It's the old Sysinternals app that Microsoft bought
up out.
vote
shareimprove this answer answered Sep 7 '08 at 6:38
102
down
vote

Dane
3,80541420
add a comment
netstat -aon | find /i "listening"

answered Sep 7 '08 at 6:32


up vote
47 down shareimprove this answer
vote
aku
59.5k19131177
3 I just tried this and it doesn't show any process info. J c Oct 14 '08 at 14:56
"doesn't show any process info" huh? it shows process ids of all listening
3 processes. If you need name of process, use Brad's solution aku Oct 15 '08 at
4:04
My bad, didn't see the PID as I was looking for the process name. J c Oct 17 '08
at 12:01
3 +1 for showing the pid vladr Mar 28 '11 at 20:16
o that's nice! I forgot about this. gumuruh Apr 17 '14 at 6:20
show 2 more comments
up vote
1. Open a command prompt window (as Administrator) From "Start\Search box"
22 down
Enter "cmd" then right-click on "cmd.exe" and select "Run as Administrator"
vote
2. Enter: netstat -abno
-a Displays all connections and listening ports.
-b Displays the executable involved in creating each connection or listening
port. In some cases well-known executables host multiple independent
components, and in these cases the sequence of components involved in creating
the connection or listening port is displayed. In this case the executable name is
in [] at the bottom, on top is the component it called, and so forth until TCP/IP
was reached. Note that this option can be time-consuming and will fail unless
you have sufficient permissions.
-n Displays addresses and port numbers in numerical form.
-o Displays the owning process ID associated with each connection.
3. Find the Port that you are listening on under "Local Address"
4. Look at the process name directly under that.
NOTE: To find the process under Task Manager
1. Note the PID (process identifier) next to the port you are looking at.

2. Open Windows Task Manager.


3. Select the Processes tab.
4. Look for the PID you noted when you did the netstat in step 1.
o

If you dont see a PID column, click on View / Select Columns. Select
PID.

Make sure Show processes from all users is selected.


answered Nov 8 '12 at 1:49

shareimprove this answer


Cyborg
33335
add a comment
You can get more information if you run the following command:
netstat -aon |find /i "listening" |find "port"

using the 'Find' command allows you to filter the results. find /i "listening" will display
only ports that are 'Listening'. Note, you need the /i to ignore Case otherwise you would
type find "LISTENING". |find "port" will limit the results to only those containing the
up vote specific port number. Note, on this it will also filter in results that have the port number
15 down anywhere in the response string.
vote
answered Oct 8 '13 at 18:56
shareimprove this answer
Nathan24
322312
add a comment
If you'd like to use a GUI tool to do this there's SysInternals TCPView.
answered Sep 7 '08 at 6:40
up vote 6
down
shareimprove this answer
vote
Dave Webb
96.9k25207247
add a comment

netstat -a -o This shows the PID of the process running on a particular port.
Keep in mind the process id and go to Task manager and services or details tab and
end the process which has the same PID.
up vote 4
down vote

Thus you can kill a process running on a particular port in windows.


answered Aug 13 '13 at 2:32
shareimprove this answer
nisha
192515
add a comment
To get a list of all the owning process ID associated with each connection:
netstat -ao |find /i "listening"

If want to kill any process have the id and use this commanf, so that port become
free
up vote 4
down vote

Taskkill /F /IM pidof a process

answered Apr 17 '14 at 14:38


shareimprove this answer
Monis Majeed
1395
add a comment
I agree with Dave Webb - SysInternals tools for sure.

http://live.sysinternals.com/
UNC Path \\live.sysinternals.com

up vote 3
down vote

answered Sep 7 '08 at 6:55


shareimprove this answer
MotoWilliams
1,20711118
add a comment

up vote 3 Follow these tools :- From cmd :- C:\> netstat -anob with Administrator
down vote privilege.

http://technet.microsoft.com/en-us/sysinternals/bb896653 - Process Explorer


http://technet.microsoft.com/en-us/sysinternals/bb896645 - Process Dump
http://technet.microsoft.com/en-us/sysinternals/bb896644 - Port Monitor
All from sysinternals.com
If you just want to know process running and threads under each process, I
recommend to learn about wmic. Wonderful cmd line tool, which gives you much
more than you can know.
Exampe :c:\> wmic process list brief /every:5

Above command will show all process list in brief every 5 seconds. To know more,
you can just go with /? command of windows , for E.g,
c:\>wmic /?
c:\>wmic process /?
c:\>wmic prcess list /?

and so on and so forth. :)


community wiki
shareimprove this answer

edited Aug 11 '13 at 18:51


2 revs
Perl Fanatic

add a comment
up vote 2 first we find process id of that particular task which we need to eliminate in order to
down vote get port free
type
netstat -n -a -o
after executing this command in windows command line prompt(cmd) select the pid
which i think the last column suppose this is 3312
now type
taskkill /F /PID 3312
u can now cross check by typing netstat command.

NOTE: sometimes windows doesn`t allow you to run this command directly on CMD
so first you need to go with this steps from start-> command prompt (right click on
command prompt, and run as administrator)
answered Aug 23 '14 at 15:25
shareimprove this answer
Pankaj Pateriya
262
add a comment
and netstat -ab tell you the application, but if you're not admin you'll
get "The requested operation requires elevation".
netstat -ao

up vote 1
It's not ideal, but if you use sysinternals Process Explorer you can go to specific
down
processes' properties and look at the TCP tab to see if they're using the port you're
vote
interested in. Bit of a needle and haystack thing, but maybe it'll help someone....
shareimprove this answer

Vous aimerez peut-être aussi