【问题标题】:Process listening which Port on Windows进程监听 Windows 上的哪个端口
【发布时间】:2012-11-05 08:55:00
【问题描述】:

在 Windows 和 Linux 上,如何找出哪个进程正在侦听哪个端口? 是否有一些应用程序明确监控?

【问题讨论】:

    标签: linux windows networking


    【解决方案1】:

    一些很棒的工具是由 Sysinternals 开发的,现在归微软所有。

    你想要的是 Tcpview,它会显示端口和打开了端口的应用程序,以及 PID 和其他好东西。 Tcpview 是基于 Windows 的,但它们也有命令行版本。所有这些工具都是免费的。

    This is the link Microsoft's sysinternals downloads

    【讨论】:

      【解决方案2】:

      Windows 和 Linux 都内置了 netstat-command,尽管它们的使用方式不同。

      在 Windows 上:netstat -a -b(列出监听和连接的端口)

      在 Linux 上:netstat -l -p(仅列出监听端口)

      【讨论】:

        【解决方案3】:

        在 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
        

        【讨论】:

          【解决方案4】:

          不确定 stackoverflow 是否适合这个问题,也许http://www.superuser.com 会是更好的选择。

          虽然从我的头顶:

          • Linux 有lsofnetstat 命令可以提供这些信息。
          • Windows 有 ProcessExplorer 应该提供此信息。

          【讨论】:

          • 如何使用lsof查看哪个进程在使用80端口?
          【解决方案5】:

          在 Linux 中,您可以使用ss 命令转储套接字信息。它还提供有关客户端活动端口号的信息。更多详情可在这找到 http://linux.die.net/man/8/ss

          【讨论】:

            猜你喜欢
            • 2022-07-12
            • 1970-01-01
            • 1970-01-01
            • 2013-06-17
            • 2016-08-12
            • 2012-04-09
            • 1970-01-01
            • 2010-09-10
            • 1970-01-01
            相关资源
            最近更新 更多