Ubuntu网络实用命令
一、主要内容本文主要讲解Ubuntu下的网络故障排查方法。1查看网络监听端口tiantian-hang:~$ sudo ss -tunlp [sudo] password for tian: Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process udp UNCONN 0 0 0.0.0.0:56808 0.0.0.0:* users:((avahi-daemon,pid1009,fd14)) udp UNCONN 0 0 127.0.0.54:53 0.0.0.0:* users:((systemd-resolve,pid812,fd16)) udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:((systemd-resolve,pid812,fd14)) udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:* users:((avahi-daemon,pid1009,fd12)) udp UNCONN 0 0 [::]:38033 [::]:* users:((avahi-daemon,pid1009,fd15)) udp UNCONN 0 0 [::]:5353 [::]:* users:((avahi-daemon,pid1009,fd13)) tcp LISTEN 0 4096 0.0.0.0:22 0.0.0.0:* users:((sshd,pid1767,fd3),(systemd,pid1,fd259)) tcp LISTEN 0 128 127.0.0.1:6010 0.0.0.0:* users:((sshd,pid1831,fd8)) tcp LISTEN 0 4096 127.0.0.1:631 0.0.0.0:* users:((cupsd,pid1314,fd7)) tcp LISTEN 0 4096 127.0.0.54:53 0.0.0.0:* users:((systemd-resolve,pid812,fd17)) tcp LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:((systemd-resolve,pid812,fd15)) tcp LISTEN 0 4096 [::]:22 [::]:* users:((sshd,pid1767,fd4),(systemd,pid1,fd260)) tcp LISTEN 0 128 [::1]:6010 [::]:* users:((sshd,pid1831,fd7)) tcp LISTEN 0 4096 [::1]:631 [::]:* users:((cupsd,pid1314,fd6))ss是Ubuntu系统自带的命令Ubuntu中还有类似的命令netstat都是用来查看网络状态的netstat需要安装属于net-tool工具里面的。它是比较古老的Ubuntu命令现代建议使用ss。命令解析-tTCP 连接 -uUDP 连接 -n数字端口不解析域名 / 服务名 -l只看监听端口本地服务 -p显示占用端口的进程 PID / 程序名需要 root/sudo

相关新闻