mac下使用lsof命令檢視鏈路狀態
阿新 • • 發佈:2019-02-11
在Linux環境系統下使用netstat -tulnp命令可以達到這一效果:
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
在mac osx下可以使用這條命令
chenfeihaodeMacBook-Pro:etc chenfeihao$ lsof -iTCP -sTCP:LISTEN -nP COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME rapportd 431 chenfeihao 3u IPv4 0x8d98aaf0bb36924d 0t0 TCP *:58158 (LISTEN) rapportd 431 chenfeihao 4u IPv6 0x8d98aaf0a4ec80c5 0t0 TCP *:58158 (LISTEN) mysqld 575 chenfeihao 21u IPv4 0x8d98aaf0a531324d 0t0 TCP 127.0.0.1:3306 (LISTEN) com.docke 598 chenfeihao 21u IPv4 0x8d98aaf09f41b8ed 0t0 TCP *:6379 (LISTEN) com.docke 598 chenfeihao 22u IPv4 0x8d98aaf0a42ba8ed 0t0 TCP *:80 (LISTEN) com.docke 598 chenfeihao 23u IPv6 0x8d98aaf09c8bcc45 0t0 TCP [::1]:6379 (LISTEN) com.docke 598 chenfeihao 24u IPv4 0x8d98aaf09c8c224d 0t0 TCP *:15672 (LISTEN) com.docke 598 chenfeihao 25u IPv6 0x8d98aaf09c8bc685 0t0 TCP [::1]:15672 (LISTEN) com.docke 598 chenfeihao 26u IPv4 0x8d98aaf0a42bc50d 0t0 TCP *:5672 (LISTEN) com.docke 598 chenfeihao 27u IPv6 0x8d98aaf09c8bc0c5 0t0 TCP [::1]:5672 (LISTEN) com.docke 598 chenfeihao 28u IPv4 0x8d98aaf0a4e2724d 0t0 TCP *:6380 (LISTEN) com.docke 598 chenfeihao 29u IPv6 0x8d98aaf09c8bbb05 0t0 TCP [::1]:6380 (LISTEN) com.xunle 4089 chenfeihao 39u IPv4 0x8d98aaf0ab7cc50d 0t0 TCP *:10000 (LISTEN) com.xunle 4089 chenfeihao 40u IPv4 0x8d98aaf0b292950d 0t0 TCP *:10800 (LISTEN) com.xunle 4089 chenfeihao 47u IPv4 0x8d98aaf0a76b350d 0t0 TCP *:57935 (LISTEN) QQ 7431 chenfeihao 36u IPv4 0x8d98aaf09f41de6d 0t0 TCP 127.0.0.1:4300 (LISTEN) QQ 7431 chenfeihao 37u IPv4 0x8d98aaf0b3891bad 0t0 TCP 127.0.0.1:4301 (LISTEN) idea 13218 chenfeihao 224u IPv4 0x8d98aaf09c8c18ed 0t0 TCP 127.0.0.1:6942 (LISTEN) idea 13218 chenfeihao 231u IPv4 0x8d98aaf0bce7ee6d 0t0 TCP *:49955 (LISTEN) idea 13218 chenfeihao 673u IPv4 0x8d98aaf09f72d24d 0t0 TCP 127.0.0.1:63342 (LISTEN) idea 13218 chenfeihao 741u IPv4 0x8d98aaf0b292824d 0t0 TCP 127.0.0.1:49951 (LISTEN)
快去給環境變數配置檔案給命令配置別名吧(偷笑)