我已经通过 SSH 连接到一台运行 Linux 的机器,并想知道;在Linux中是否有任何命令可以ping计算机或将域名转换为IP地址?
小智 7
"ping" 和 "nslookup" 假设你已经安装了 SSH 的机器:
you@yourhost:~$ ping www.google.com
PING www.l.google.com (173.194.37.104) 56(84) bytes of data.
64 bytes from lhr14s02-in-f104.1e100.net (173.194.37.104): icmp_seq=1 ttl=57 time=27.8 ms
64 bytes from lhr14s02-in-f104.1e100.net (173.194.37.104): icmp_seq=2 ttl=57 time=27.1 ms
you@yourhost:~$ nslookup www.google.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
www.google.com canonical name = www.l.google.com.
Name: www.l.google.com
Address: 173.194.37.104
Run Code Online (Sandbox Code Playgroud)