PING Command in Linux: PING is a shortened form of Packet Internet or Inter-Network Groper. The Ping Command is one of the most used utilities for identifying, troubleshooting and testing issues related to network connectivity. The Ping command takes input as the URL or IP address and sends a data packet with the message “PING” to the specified address and obtain a response from the host/server and this recorded time is called latency. Ping works by sending ICMP (Internet Control Message Protocol) echo request messages to a defined IP destination on the network and waits for the ICMP reply. Using this ping command, you can test if a host is reachable(active) on an IP network or not. In an Internet Protocol (IP) packet, Time-to-live (TTL) is a value that informs a network router whether or not the IP packet has been in the network too long and should be rejected. In general, the ping time is calculated in milliseconds. It is the round trip time for the packet to reach the host/server and for the return response to the sender. In this article, we will assist you to make use of ping command Linux effectively.
- How to use Ping Command?
- Examples to use Ping Command
- Ping Command – Options
- Get Help from Ping Command
- A Short Summary
How to use Ping Command?
The ping command needs to be used in the below format in your Ubuntu Terminal. In the destination place, you can type/paste the URL/IP address in order to check the network connectivity.
Note: To stop pinging, you have to use Ctrl+C or else it will keep on sending packets.
- In the below screenshot, you can find that we have used google URL to illustrate the ping command usage. You just have to click on Ctrl+C to stop the ping process. You can find the details related to TTL, time, packets transmitted/received and packets loss over the network.
Examples to use Ping Command:
Let’s look out some examples of using Ping command with the available options.
Execute the below command to know the version of ping available on your system.
To control the number of pings:
In order to define the number of packets that you want to send to the host/server, you have to use the below command format.
Ping Command – Options:
Options: <destination> dns name or ip address -a use audible ping -A use adaptive ping -B sticky source address -c <count> stop after <count> replies -D print timestamps -d use SO_DEBUG socket option -f flood ping -h print help and exit -I <interface> either interface name or address -i <interval> seconds between sending each packet -L suppress loopback of multicast packets -l <preload> send <preload> number of packages while waiting replies -m <mark> tag the packets going out -M <pmtud opt> define mtu discovery, can be one of <do|dont|want> -n no dns name resolution -O report outstanding replies -p <pattern> contents of padding byte -q quiet output -Q <tclass> use quality of service <tclass> bits -s <size> use <size> as number of data bytes to be sent -S <size> use <size> as SO_SNDBUF socket option value -t <ttl> define time to live -U print user-to-user latency -v verbose output -V print version and exit -w <deadline> reply wait <deadline> in seconds -W <timeout> time to wait for response
IPv4 options: -4 use IPv4 -b allow pinging broadcast -R record route -T <timestamp> define timestamp, can be one of <tsonly|tsandaddr|tsprespec>
IPv6 options: -6 use IPv6 -F <flowlabel> define flow label, default is random -N <nodeinfo opt> use icmp6 node info query, try <help> as argument
Get Help from Ping Command:
In order to get help from the Ping command, you have to execute any one of the following commands on the Ubuntu Terminal.
A Short Synopsis:
In the above article, we have described the usage of ping command Linux with relevant examples for your reference. We hope that you can utilize this command on Linux Ubuntu 19.10 Eoan Ermine/ 18.04 LTS Bionic Beaver in an effortless manner. If you find this article is helpful, kindly share your valuable queries/suggestions in the below comment section.