ping command

ping (Packet Internet Groper) is the most commonly used tool for troubleshooting a network, included with most operating systems. It is invoked using the ping command. The ping command uses ICMP (Internet Control Message Protocol) and works by sending an ICMP echo request message to the specified IP address. If the computer with the destination IP address is reachable, it responds with an ICMP echo reply message. The ping command outputs some information about a network performance, e.g. the round-trip time (the time from the packet transmission to reception).

ping can help you isolate where a network problem occurs. For instance, if you can ping local computers but not remote systems, the problem is most probably your router. If you can ping by IP address but not by hostname, the problem is probably your DNS configuration.

Here is an output of the ping command in Ubuntu:

linux ping command

In the example above you can see that we have pinged the IP address of By default, ping sends ICMP request packets once every second until you interrupt it with the Ctrl+C keystroke. As you can see from the output above, the host is reachable and has replied with the ICMP reply packets. You can also see that the remote host has replied within 1 ms, which indicates that the network is not congested.

You can specify the number of packets to send by using the -c option:

linux ping number of packets

To can change the packet size, you can use the -s option:

linux ping packet size

Geek University 2022