zoukankan      html  css  js  c++  java
  • lsof/netstat命令的一个重要作用: 根据进程查端口, 根据端口查进程

      我们知道, 根据ps -aux | grep xxx就是很快实现进程名和进程号的互查, 所以我们只说进程号pid就行。 如下示例中, 进程pid常驻。

            1.  根据进程pid查端口:

                 lsof -i | grep pid

            2.  根据端口port查进程(某次面试还考过):

                lsof  -i:port     

            3. 根据进程pid查端口:

               netstat -nap | grep pid

            4.  根据端口port查进程

               netstat -nap | grep port

             从形式上看, netstat -nap 更好记忆, 但lsof的用法也要熟练。
    ---------------------
    作者:stpeace
    来源:CSDN
    原文:https://blog.csdn.net/stpeace/article/details/69934763
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    查看文件 ls -lh
    java Dom4j xml 写
    centos tar 常用
    os && shutil 模块
    Visual Studio
    ssh 无法登陆
    find 命令
    Centos7 安装redis
    zerorpc
    uwsgi
  • 原文地址:https://www.cnblogs.com/saolv/p/10171648.html
Copyright © 2011-2022 走看看