arvind.mohan
arvind.mohan

Reputation: 914

Process listening which Port on Windows

How can you find out which process is listening upon which port on Windows and Linux? Are there some Applications explicitly monitoring?

Upvotes: 0

Views: 6569

Answers (5)

Terje Mikal
Terje Mikal

Reputation: 947

Both Windows and Linux has the netstat-command built-in, although they are used differently.

On Windows: netstat -a -b (lists both listening and connected ports)

On Linux: netstat -l -p (lists only listening ports)

Upvotes: 1

Rohan
Rohan

Reputation: 53326

On windows 7, you can use

netstat -b -a

netstat /?

-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.
-o      Displays the owning process ID associated with each connection.

On Linux use, -p needs root privileges.

#netstat -p

#netstat -h
-p, --programs           display PID/Program name for sockets

Upvotes: 0

Sakthi Kumar
Sakthi Kumar

Reputation: 3045

In Linux you can use the ss command to dump the socket information. It gives information about active port numbers in the client side also. More details can be found here http://linux.die.net/man/8/ss

Upvotes: 0

display101
display101

Reputation: 2085

Not sure that stackoverflow is the right place for this question, maybe http://www.superuser.com would be a better choice.

Although from the top of my head:

  • Linux has lsof and netstat commands that will provide this information.
  • Windows has ProcessExplorer that should give this information.

Upvotes: 0

Johnnie
Johnnie

Reputation: 305

Some great tools for this are made by Sysinternals, now owned by Microsoft.

The one you want is Tcpview and it will show you the ports and which application has them opened, as well as the PID and other nice things. Tcpview is windows based but they have a command line version as well. All these tools are free.

This is the link Microsoft's sysinternals downloads

Upvotes: 1

Related Questions