ping command
LINUX-Frequently used commands
ping command Checking for communication with hosts on the network. |
Syntax |
ping [Option] [Host name (or IP address)] |
The ping command sends ICMP packets to the host specified as the destination, and measures whether the destination host responds, the network reply time, etc.. This is mainly used to check that the destination host and network equipment are working and communicating correctly.. The Linux ping command sends a packet to the specified remote host every second. Linux ping command sends a packet to the specified remote host every second, but does not send 4 packets by default and then quit like Windows. Note that if the option is not specified, the packet will continue to be sent endlessly unless the user cancels it with the interrupt key. To exit the ping command, press 'Ctrl' + 'c'.. |
Frequently used options |
-c Number of packets to be sent -i The interval at which packets are sent |
Example: Checking the status of communication with a host (specifying IP address). |
$ ping 192.168.11.51 ← Run by IP address PING 192.168.11.51 (192.168.11.51) 56(84) bytes of data. 64 bytes from 192.168.11.51: icmp_seq=1 ttl=128 time=0.268 ms 64 bytes from 192.168.11.51: icmp_seq=2 ttl=128 time=0.240 ms 64 bytes from 192.168.11.51: icmp_seq=3 ttl=128 time=0.310 ms 64 bytes from 192.168.11.51: icmp_seq=4 ttl=128 time=0.281 ms 64 bytes from 192.168.11.51: icmp_seq=5 ttl=128 time=0.214 ms 64 bytes from 192.168.11.51: icmp_seq=6 ttl=128 time=0.352 ms 64 bytes from 192.168.11.51: icmp_seq=7 ttl=128 time=0.290 ms 64 bytes from 192.168.11.51: icmp_seq=8 ttl=128 time=0.206 ms 64 bytes from 192.168.11.51: icmp_seq=9 ttl=128 time=0.254 ms 64 bytes from 192.168.11.51: icmp_seq=10 ttl=128 time=0.293 ms 64 bytes from 192.168.11.51: icmp_seq=11 ttl=128 time=0.207 ms 64 bytes from 192.168.11.51: icmp_seq=12 ttl=128 time=0.342 ms 64 bytes from 192.168.11.51: icmp_seq=13 ttl=128 time=0.223 ms 64 bytes from 192.168.11.51: icmp_seq=14 ttl=128 time=0.217 ms 64 bytes from 192.168.11.51: icmp_seq=15 ttl=128 time=0.267 ms ^C --- 192.168.11.51 ping statistics --- 15 packets transmitted, 15 received, 0% packet loss, time 13999ms rtt min/avg/max/mdev = 0.206/0.264/0.352/0.047 ms 15 packets transmitted Number of packets sent |
Example: Checking the status of communication with a host (host name specification). |
$ ping Panser ←Run with hostname Panser PING Panser (192.168.11.51) 56(84) bytes of data. 64 bytes from Panser (192.168.11.51): icmp_seq=0 ttl=64 time=0.185 ms 64 bytes from Panser (192.168.11.51): icmp_seq=1 ttl=64 time=0.179 ms 64 bytes from Panser (192.168.11.51): icmp_seq=2 ttl=64 time=0.166 ms 64 bytes from Panser (192.168.11.51): icmp_seq=3 ttl=64 time=0.174 ms 64 bytes from Panser (192.168.11.51): icmp_seq=4 ttl=64 time=0.170 ms 64 bytes from Panser (192.168.11.51): icmp_seq=5 ttl=64 time=0.158 ms |
Example: Check the communication status by specifying the number of times. |
$ ping -c 5 Panser ← Run 5 times PING Panser (192.168.11.51) 56(84) bytes of data. 64 bytes from Panser (192.168.11.51): icmp_seq=0 ttl=64 time=0.184 ms 64 bytes from Panser (192.168.11.51): icmp_seq=1 ttl=64 time=0.175 ms 64 bytes from Panser (192.168.11.51): icmp_seq=2 ttl=64 time=0.174 ms 64 bytes from Panser (192.168.11.51): icmp_seq=3 ttl=64 time=0.174 ms 64 bytes from Panser (192.168.11.51): icmp_seq=4 ttl=64 time=0.170 ms |