簡體   English   中英

進程監聽哪個端口在Windows上

[英]Process listening which Port on Windows

如何確定哪個進程正在偵聽Windows和Linux上的哪個端口? 是否有一些應用程序明確監控?

一些很好的工具是由現在由微軟擁有的Sysinternals制作的。

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

這是Microsoft的sysinternals下載鏈接

Windows和Linux都內置了netstat ,盡管它們的使用方式不同。

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

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

不確定stackoverflow是否適合這個問題, http://www.superuser.com可能是更好的選擇。

雖然從頭到尾:

  • Linux有lsofnetstat命令可以提供這些信息。
  • Windows有ProcessExplorer應該提供此信息。

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

在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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM