The ping command is used to test the availability of a remote or destination machine on a network. In this tutorial, I'll show you it's various uses on Windows operating systems.
All the commands can be run on a command prompt or PowerShell. I have tested the tutorial on Windows 11, however, it works on older Windows versions like Windows 10 too.
How to Ping a Machine
To ping any machine, execute the following command
ping <IP address of machine suppose 127.0.0.1>
How to Constantly Ping/Send Requests to a Destination Machine
By default, ping sends 4 packets to the destination machine. If you want ping to constantly send a packet to your machine, use the -t switch. When you want to stop the ping command from sending packets, press CTRL and C simultaneously from your keyboard. The ping command should look like the following:
ping <IP address of machine suppose 127.0.0.1> -t
How to Ping/Send Requests to Destination Machine for the Desired Number of Times
By default, ping sends 4 requests or a destination machine is pinged 4 times. But, if you want to send your desired number of requests, you will have to use -n switch. The complete command should look like the following,
ping <IP address of machine suppose 127.0.0.1> -n count
Example:
ping 127.0.0.1 -n 10
How to Send a Specific Packet Size in Ping Request
By Default, ping request sends a 32-byte packet to the destination machine. If you want to change, you will have to use -l switch. The complete command should look like the following,
ping <IP address of machine suppose 127.0.0.1> -l size
The packet size can be any value from 32 to 65,527.
Example:
ping 127.0.0.1 -l 64
How to Make a Ping Request to resolve an IP address to Host Name
If you want a ping request to resolve an IP address to a hostname, you will have to use the -a switch. The complete command should look like the following,
ping <IP address of machine suppose 127.0.0.1> -a
Conclusion
There are many switches available you can use with the ping command. However, I have explored the commonly used in this tutorial.