V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
wind3110991
V2EX  ›  Linux

话说在 MAC OS 下如何用 netstat 查看 Listen 状态啊, netstat -tunlp 这个命令话说好像不行

  •  
  •   wind3110991 · Mar 19, 2015 · 16268 views
    This topic created in 4060 days ago, the information mentioned may be changed or developed.

    google下,大神说一个用netstat -anL
    但是这个无法查看连接的协议
    我部机输出是:
    Current listen queue sizes (qlen/incqlen/maxqlen)
    Listen Local Address

    0/0/128 *.80

    0/0/128 ::1.25035

    0/0/128 127.0.0.1.25035

    0/0/50 *.3306

    0/0/128 *.88

    0/0/128 *.88

    0/0/128 127.0.0.1.631

    0/0/128 ::1.631

    0/0/128 *.445

    0/0/128 *.445

    0/0/128 *.548

    0/0/128 *.548

    另外一个大神说用 lsof -ni | grep LISTEN
    输出:
    GitHub 497 pro 15u IPv4 0xa6e56565db9d8793 0t0 TCP 127.0.0.1:25035 (LISTEN)
    GitHub 497 pro 16u IPv6 0xa6e56565d61219b3 0t0 TCP [::1]:25035 (LISTEN)

    有没有更好的方法?

    可以输出
    netstat -tunlp的效果
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

    tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2493/portmap

    tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2776/cupsd

    tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2808/sendmail: acce
    tcp 0 0 0.0.0.0:1020 0.0.0.0:* LISTEN 2534/rpc.statd

    tcp 0 0 :::3306 :::* LISTEN 15681/mysqld

    tcp 0 0 :::22 :::* LISTEN 2767/sshd

    6 replies    2015-03-20 11:53:36 +08:00
    sunjourney
        1
    sunjourney  
       Mar 19, 2015   ❤️ 1
    netstat -a | grep LISTEN
    dorentus
        2
    dorentus  
       Mar 19, 2015
    /usr/sbin/lsof -i
    miterleo
        3
    miterleo  
       Mar 19, 2015
    lsof -iTCP -sTCP:LISTEN -nP
    wind3110991
        4
    wind3110991  
    OP
       Mar 19, 2015
    @sunjourney 你的这个方法稍微好一些~~谢谢!
    beordle
        5
    beordle  
       Mar 20, 2015
    楼主最近刷屏节奏。。yuki头像。。每次都会手贱点进来。。
    wind3110991
        6
    wind3110991  
    OP
       Mar 20, 2015
    @beordle 我错了嘛~么么大
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   984 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 21:55 · PVG 05:55 · LAX 14:55 · JFK 17:55
    ♥ Do have faith in what you're doing.