2012-11-05 40 views

回答

0

發現在Windows 7上,您可以使用

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. 

在Linux上使用,-p需要root權限。

#netstat -p 

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

Sysinternals爲微軟提供了一些很棒的工具。

你想要的就是Tcpview,它會告訴你端口和哪個應用程序打開它們,以及PID和其他好東西。 Tcpview是基於Windows的,但他們也有一個命令行版本。所有這些工具都是免費的。

This is the link Microsoft's sysinternals downloads

0

不知道計算器是這個問題的正確的地方,也許http://www.superuser.com將是一個更好的選擇。

雖然從我的頭頂:

  • Linux有lsofnetstat命令將提供此信息。
  • Windows有ProcessExplorer應該提供此信息。
+0

如何使用lsof的,看看哪個進程正在使用80端口? –

0

在Linux中,您可以使用ss命令轉儲套接字信息。它還提供有關客戶端活動端口號的信息。更多詳細信息可以在這裏 http://linux.die.net/man/8/ss

1

Windows和Linux有netstat -command內置的,雖然他們使用的是不同的。

在Windows上:netstat -a -b(名單偵聽和連接端口)

在Linux上:netstat -l -p(僅列出偵聽端口)