1 仅限 Linux
netstat -anp |grep 270/docker 查看端口/应用 有没有被用
-a 或–all 显示所有连线中的Socket。
-t 或–tcp 显示TCP 传输协议的连线状况。
-n 或–numeric 直接使用IP地址,而不通过域名服务器
grep 命令用于查找文件里符合条件的字符串。
2 仅限mac
如果需要查询inet,netstat -anvf inet netstat -anvf inet | grep 9000
如果需要查询TCP, netstat -anvp tcp netstat -anvp tcp | grep 9000
lsof -i -P -n | grep 8080 ( -n no host names -P no port names )
lsof -i:8080 (-i表示端口)
lsof -i tcp:8080 查看8080端口的TCP情况
3 Mac and Linux
ps -ef | grep docker/9000 (-e 显示所有进程。-f 全格式)
其实最好用的是help, netstat -h,哈哈 。
网友评论