Upload
martasekulic
View
214
Download
0
Embed Size (px)
DESCRIPTION
port/aplication
Citation preview
How can you find out which process is listening on a port on Windows?
up vote 316 down vote favorite
84How can you find out which process is listening on a port on Windows?
windows networking port
share
HYPERLINK "http://stackoverflow.com/posts/48198/edit" \o "" improve this questionedited Jan 17 '13 at 5:46
Vadzim5,11221847
asked Sep 7 '08 at 6:26
Readonly56k70153182
add a comment
13 Answers
active oldest votes
up vote 382 down vote accepted 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 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.
share
HYPERLINK "http://stackoverflow.com/posts/48199/edit" \o "" improve this answeredited Nov 14 '13 at 7:56
Community1
answered Sep 7 '08 at 6:28
Brad Wilson25.1k45170
45
-o to get the PID Laurent K Jul 10 '12 at 8:03
20
and taskkill /PID to then terminate the process, using /F if appropriate. BitMask777 Mar 4 '13 at 20:03
7
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 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
1
KingFeming: Gruber's comment above applies to you. Brad Wilson Oct 28 '14 at 14:20
add a comment
up vote 159 down vote There's a native GUI for Windows:
Start>>All Programs>>Accessories>>System Tools>>Resource Monitor (or Run resmon.exe)
share
HYPERLINK "http://stackoverflow.com/posts/23718720/edit" \o "" improve this answeredited Jun 8 '14 at 15:57
answered May 18 '14 at 5:02
bcorso4,5481921
16
This should be the accepted answer. data Jun 26 '14 at 9:34
3
Also shows the binding's firewall status (last column). Very util. Raphael Jul 2 '14 at 17:34
add a comment
up vote 102 down vote Use TCPView if you want a GUI for this. It's the old Sysinternals app that Microsoft bought out.
share
HYPERLINK "http://stackoverflow.com/posts/48207/edit" \o "" improve this answeranswered Sep 7 '08 at 6:38
Dane3,80541420
add a comment
up vote 47 down vote netstat -aon | find /i "listening"
share
HYPERLINK "http://stackoverflow.com/posts/48202/edit" \o "" improve this answeranswered Sep 7 '08 at 6:32
aku59.5k19131177
3
I just tried this and it doesn't show any process info. J c Oct 14 '08 at 14:56
3
"doesn't show any process info" huh? it shows process ids of all listening 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 22 down vote 1. Open a command prompt window (as Administrator) From "Start\Search box" Enter "cmd" then right-click on "cmd.exe" and select "Run as Administrator"
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.
If you dont see a PID column, click on View / Select Columns. Select PID.
Make sure Show processes from all users is selected.
share
HYPERLINK "http://stackoverflow.com/posts/13281291/edit" \o "" improve this answeranswered Nov 8 '12 at 1:49
Cyborg33335
add a comment
up vote 15 down vote 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 specific port number. Note, on this it will also filter in results that have the port number anywhere in the response string.
share
HYPERLINK "http://stackoverflow.com/posts/19255965/edit" \o "" improve this answeranswered Oct 8 '13 at 18:56
Nathan24322312
add a comment
up vote 6 down vote If you'd like to use a GUI tool to do this there's SysInternals TCPView.
share
HYPERLINK "http://stackoverflow.com/posts/48208/edit" \o "" improve this answeranswered Sep 7 '08 at 6:40
Dave Webb96.9k25207247
add a comment
up vote 4 down vote 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.
Thus you can kill a process running on a particular port in windows.
share
HYPERLINK "http://stackoverflow.com/posts/18199735/edit" \o "" improve this answeranswered Aug 13 '13 at 2:32
nisha192515
add a comment
up vote 4 down vote 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
Taskkill /F /IM pidof a process
share
HYPERLINK "http://stackoverflow.com/posts/23136177/edit" \o "" improve this answeranswered Apr 17 '14 at 14:38
Monis Majeed1395
add a comment
up vote 3 down vote I agree with Dave Webb - SysInternals tools for sure.
http://live.sysinternals.com/ UNC Path \\live.sysinternals.com
share
HYPERLINK "http://stackoverflow.com/posts/48212/edit" \o "" improve this answeranswered Sep 7 '08 at 6:55
MotoWilliams1,20711118
add a comment
up vote 3 down vote Follow these tools :- From cmd :- C:\> netstat -anob with Administrator 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. :)
share
HYPERLINK "http://stackoverflow.com/posts/18175357/edit" \o "" improve this answeredited Aug 11 '13 at 18:51
community wiki
2 revs
HYPERLINK "http://stackoverflow.com/users/2375759" Perl Fanatic
add a comment
up vote 2 down vote first we find process id of that particular task which we need to eliminate in order to get port free
typenetstat -n -a -oafter 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 3312u 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)
share
HYPERLINK "http://stackoverflow.com/posts/25463469/edit" \o "" improve this answeranswered Aug 23 '14 at 15:25
Pankaj Pateriya262
add a comment
up vote 1 down vote netstat -ao and netstat -ab tell you the application, but if you're not admin you'll get "The requested operation requires elevation".
It's not ideal, but if you use sysinternals Process Explorer you can go to specific processes' properties and look at the TCP tab to see if they're using the port you're interested in. Bit of a needle and haystack thing, but maybe it'll help someone....
share
HYPERLINK "http://stackoverflow.com/posts/22389550/edit" \o "" improve this answer