目录
Ping 命令
text
$ ping www.qq.com
$ ping -c 5 www.qq.com
PING ins-r23tsuuf.ias.tencent-cloud.net (121.14.77.221) 56(84) bytes of data.
64 bytes from 121.14.77.221 (121.14.77.221): icmp_seq=1 ttl=48 time=35.1 ms
64 bytes from 121.14.77.221 (121.14.77.221): icmp_seq=2 ttl=48 time=35.1 ms
64 bytes from 121.14.77.221 (121.14.77.221): icmp_seq=3 ttl=48 time=35.1 ms
64 bytes from 121.14.77.221 (121.14.77.221): icmp_seq=4 ttl=48 time=35.1 ms
64 bytes from 121.14.77.221 (121.14.77.221): icmp_seq=5 ttl=48 time=35.1 ms
--- ins-r23tsuuf.ias.tencent-cloud.net ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4005ms
netstat
netstat是一个用来查看网络状态的重要工具.
语法: netstat [选项]
功能: 查看网络状态
常用选项:
n拒绝显示别名,能显示数字的全部转化成数字l仅列出有在Listen(监听) 的服务状态p显示建立相关链接的程序名t(tcp)仅显示tcp相关选项u(udp)仅显示udp相关选项a(all)显示所有选项,默认不显示LISTEN相关
text
// 每个1s执行一次 netstat -nltp
$ watch -n 1 netstat -nltp
pidof
在查看服务器的进程id时非常方便.
语法: pidof [进程名]
功能: 通过进程名, 查看进程id
text
$ ps axj | head -1 && ps ajx | grep tcp_server
PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
2958169 2958285 2958285 2958169 pts/2 2958285 S+ 1002 0:00 ./tcp_server 8888
whb@bite01:~$ pidof tcp_server
2958285