-
ping
通过ping命令向网络主机发送一个回应请求,进而验证可否进行通信:
$ ping baidu.com
可使用
Control+C
停止发送请求。 -
诊断路由节点
$ traceroute baidu.com traceroute: Warning: baidu.com has multiple addresses; using 220.181.57.216 traceroute to baidu.com (220.181.57.216), 64 hops max, 52 byte packets 1 172.24.50.1 (172.24.50.1) 0.728 ms 0.416 ms 0.377 ms 2 10.74.0.53 (10.74.0.53) 1.131 ms 0.886 ms 0.924 ms 3 10.74.0.29 (10.74.0.29) 1.252 ms 1.051 ms 1.023 ms 4 10.74.253.10 (10.74.253.10) 1.624 ms 1.182 ms 1.206 ms 5 10.74.253.46 (10.74.253.46) 0.276 ms 0.255 ms 0.238 ms 6 123.59.170.193 (123.59.170.193) 0.711 ms 0.532 ms 0.495 ms 7 10.74.253.42 (10.74.253.42) 1.153 ms 0.974 ms 0.909 ms 8 172.16.31.77 (172.16.31.77) 4.341 ms 3.549 ms 3.402 ms 9 * * * 10 123.59.201.209 (123.59.201.209) 2.599 ms 123.59.201.201 (123.59.201.201) 2.947 ms 2.453 ms 11 * * * 12 220.181.16.213 (220.181.16.213) 3.099 ms 3.071 ms 220.181.177.185 (220.181.177.185) 3.558 ms 13 * * * 14 220.181.17.150 (220.181.17.150) 3.202 ms 220.181.17.18 (220.181.17.18) 3.058 ms 220.181.17.22 (220.181.17.22) 2.770 ms 15 * * * 16 * * * 17 * * * 18 * * *
-
检查某个主机是否运行 HTTP 服务,或者检查某网站是否可用
$ curl -I www.oschina.net | head
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 277 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
HTTP/1.1 200 OK
Server: bfe/1.0.8.18
Date: Wed, 12 Dec 2018 10:39:50 GMT
Content-Type: text/html
Content-Length: 277
Last-Modified: Mon, 13 Jun 2016 02:50:08 GMT
Connection: Keep-Alive
ETag: "575e1f60-115"
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Pragma: no-cache
//不通
$ curl -I www.oschddfina.net | head
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: www.oschddfina.net
-
来诊断域名信息
$ dig www.oschina.net A
$ dig www.oschina.net MX
-
查看谁正在登录到你的 Mac 机器
$ w
显示系统路由表
$ netstat -r
显示活动网络连接
$ netstat -an
显示网络统计
$ netstat -s