What is Ping command?
Ping command is a simple network utility tool. It has a command-line interface. You can write different commands and test various elements of your network – a computer on the network, the router, a particular domain, or IP address.
The ping command uses ICMP – Internet control message protocol. When you are performing a check, you need to set a target, and additionally, you can add options for the number of packets, continuous pinging, timeout limits, IPv4 or IPv6, and more.
You will get a response with additional statistics.
An ICMP request is a small packet of data that your computer will send to the target. The target should bounce it back and send an answer for each ping.
You can find the Ping command on Linux and macOS through the Terminal application, or on Windows, through the Command Prompt.
You should also be able to find it on Android or iOS/iPadOS through a third-party Terminal application.
How to use Ping command?
Let’s see first how to use ping command on Linux or macOS and check a few examples.
Open the Terminal application.
For some of the cases, you can use Windows too. On it, you will need to open the Command Prompt for performing the commands.
*We will use example IP addresses and yourdomain.com. Please feel free to change the text and use the examples with your own domain or device (IP address).
Basic Ping command. You will see if you can reach the target. That way, you can see if you, or the device you are probing, are connected. The result would be continuous ping on Linux or macOS (Stop with Ctrl-C), or 4 replies and statistics if there were no problems.
For continuous ping on Windows, you need to use the extra option “-t” and the ping that you want to perform is:
ping -t yourdomain.com
Send more ping requests (custom number of requests). You can make more than 4 requests on Windows or a specific amount of requests on Linux/macOS.
ping –c 8 yourdomain.com
ping –n 8 yourdomain.com
Set an interval between the pings. You can set the time in seconds between the requests.
ping -i 20 22.214.171.124
Set a timeout period in seconds to stop the ping command on Linux/macOS.
ping –w 50 yourdomain.com
Get the statistics only on your ping request, not showing the individual pings.
ping –q yourdomain.com
Set the packet’s size to a value that you want. The default is 56 bytes on Linux/macOS and 32 bytes on Windows. Let’s put 112.
ping -s 112 yourdomain.com
Ping option for extended functionality Linux/macOS and Windows.
For those of you who are using Linux or macOS, in the Terminal application, write:
|-a||You will hear a sound when the pings arrive.|
|-b||Allows the ping to broadcast IP address.|
|-B||Don’t allow ping to change the source IP address.|
|-c (count)||The number of ping to send.|
|-f||Flood the network with pings.|
|-i (interval)||Interval between pings.|
|-I (interface address)||Source IP address to interface IP address.|
|-1 (reload)||Number of pings without waiting for replies.|
|-n||Show hostname in result.|
|-V||Version of ping command.|
|-w (deadline)||Time to stop the ping command.|
|-W (timeout)||Waiting time for a resonse.|
For Windows users open the Command Prompt and write:
|-a||Resolve IP address to hostname.|
|-n||Number of pings.|
|-l||Send the size of the buffer.|
|-f||Stop IPv4 flag fragmentation.|
|-v||Not working anymore.|
|-r||Trace route IPv4.|
|-s||Timstamp on each hop IPv4|
|-j||Loose source route along host-list IPv4.|
|-k||Strict source route along host-list IPv4.|
|-w||Wait for response time.|
|-R||Trace route IPv6|
|-c||Router compartment identifier.|
|-p||Ping Hyper-V network.|