繁体   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