All the Linux distros come up with a number of default tools that can perform a number of tasks. Of course, you can use other 3rd-party apps and tools to perform more complex tasks. However, some of the basic tools are incredibly important and handy in different situations. Ping is definitely one of them.
Today, let’s check out all the usage of “ping” tool on Linux.
Basic “ping”
At first, let’s check out the basics of “ping”. Fire up a terminal and run the following command –
ping osradar.com
Here, we pinged OS Radar with 64 bytes of data. Note that the process is infinite, so you have to manually terminate the process by pressing “Ctrl + C”.
You can identify the version of the “ping” tool by running the following command –
ping -V
Advanced usage
Generally, “ping” continues pinging infinitely. However, you have the power to change the time it pings the target domain. Run the following command –
ping -c 3 osradar.com
Here, “ping” will ping OS Radar for 10 times.
Do you need a different data packet size? Then run the following command –
ping -s 100 osradar.com
This command will ping OS Radar with 108 bytes. That’s suffice to say that if you define X bytes, “ping” will ping with (X + 8) bytes.
Time is also a factor here. All the above examples were pinging continuously, infinitely. If you want to run “ping” for a certain period, then run this command –
ping -w 5 osradar.com
Here, “ping” will continue pinging OS Radar for 10 seconds. Need to put interval between each ping? Then run this command –
ping -i 2 osradar.com
This command tells “ping” to ping OS Radar for Note that by default, “ping” pings the target domain every 1 second.
Need a noise every time “ping” pings successfully? Use this command –
ping -a osradar.com
In most of the cases, we don’t care about the continuous results of the ping. The final result is the most important part of all. If you want to run “ping” in a silent mode, then run the following command –
ping -q -c 10 osradar.com
Make sure to run this command with “-c” parameter, otherwise it won’t show any result in the future.
Happy pinging!