沙滩星空的博客沙滩星空的博客

netstat命令:查看端口占用情况

列出所有端口

netstat -ntlp

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      3710/mysqld
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      3002/memcached
tcp        0      0 0.0.0.0:22127           0.0.0.0:*               LISTEN      8250/sshd
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3432/httpd
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      3432/httpd

n 显示数字 t TCP类型 l 监听 p PID进程

    -r, --route                display routing table
    -I, --interfaces=<Iface>   display interface table for <Iface>
    -i, --interfaces           display interface table
    -g, --groups               display multicast group memberships
    -s, --statistics           display networking statistics (like SNMP)
    -M, --masquerade           display masqueraded connections

    -v, --verbose              be verbose
    -n, --numeric              don't resolve names
    --numeric-hosts            don't resolve host names
    --numeric-ports            don't resolve port names
    --numeric-users            don't resolve user names
    -N, --symbolic             resolve hardware names
    -e, --extend               display other/more information
    -p, --programs             display PID/Program name for sockets
    -c, --continuous           continuous listing

    -l, --listening            display listening server sockets
    -a, --all, --listening     display all sockets (default: connected)
    -o, --timers               display timers
    -F, --fib                  display Forwarding Information Base (default)
    -C, --cache                display routing cache instead of FIB
    -T, --notrim               stop trimming long addresses
    -Z, --context              display SELinux security context for sockets


Linux netstat命令详解 https://www.cnblogs.com/ftl1012/p/netstat.html
未经允许不得转载:沙滩星空的博客 » netstat命令:查看端口占用情况

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址