The Ping command explained.
Ping command is an easy-to-use network utility tool with a command-line interface. When you type different commands, you can test many parts of your network, such as the router, computer on the network, a selected domain, or IP address.
The ping command benefits from using ICMP (Internet Control Message Protocol). When you want to make a check, you have to choose a target. In addition to that, you can add options, such as the number of packets, timeout limits, continuous pinging, IPv4 or IPv6, etc.
You will receive an answer with statistics.
The ICMP request is a small packet of data, which your device will send to the target. The target has to bounce it back and provide a response for every ping.
The ping command is available on macOS and Linux within the Terminal application. On Windows, you can use it through the Command Prompt.
How does the Ping command work?
Why use it?
- Connectivity test. – Using applications or systems on network connectivity is essential. A fast ping proves that the two devices can communicate.
- Troubleshooting. – Each echo response gives clues for identifying and solving problems. For example, if the echo response takes a longer time to arrive, this can show a routing problem, congestion, or sluggishness on the network.
- Monitoring. – You can check the devices’ availability on a network and the network’s performance through a ping.
How to test with the ping command?
First, let’s observe how to use the ping command on Linux or macOS. Also, let’s check some examples.
For this case, open the Terminal application. If you use Windows, you will have to open the Command Prompt for completing the commands.
*For our purposes, we will use IP addresses, which are just an example, and exampledomain.com. Please feel free to change the text and use the samples with the domain or device (IP address) you want.
Basic Ping command. – You are capable of checking if you can reach the target. This allows you to see if you, or the machine you are testing, are connected. The result will be constant ping on Linux or macOS. You can stop it with Ctrl-C. The other possible case on Windows is receiving 4 replies and statistics if there are no problems.
For constant ping on Windows, you have to apply an additional option “-t.” The ping that you have to make is:
ping -t exampledomain.com
You can send a higher number of ping requests or a custom number of requests. For example, on Windows, you can perform more than 4 requests. And a particular amount of requests on macOS/Linux.
ping –c 8 exampledomain.com
ping –n 8 exampledomain.com
You can establish an interval between the pings. Between the requests, you can arrange time in seconds.
ping -i 20 188.8.131.52
You can establish a timeout period. It is in seconds, commonly to stop the ping command on macOS/Linux.
ping –w 50 exampledomain.com
You can receive the statistics only on your ping request. And not revealing the individual pings.
ping –q exampledomain.com
You can arrange the packet’s size to the amount that you require. On Linux and macOS, the default is 56 bytes. On Windows is 32 bytes.
Let’s put in example 112.
ping -s 112 exampledomain.com