How to use Ping command on Windows, Linux & macOS
Using Ping on Windows, Linux and macOS is an easy way to check whether there’s a working connection between two PCs on a network. Here’s how to do it on Windows, Linux and MacOS.
Unix terminals and Windows Command Prompt are built on decades of technology. Some things might have long since been phased out, but you can still use “Finger” to poke around various websites for information.
One thing that’s not been lost to time is Ping. This command is great for checking on the various PCs on a network, especially for devices that are running Plex servers or something similar.
You can also use it to check the network speed between two PCs, so you know how fast a large network transfer will take.
Thankfully, Ping appears to be pretty universal between systems, with Linux and macOS functioning nearly the same as Windows does.
You can also use Ping to check to see if a website is up and running. Simply typing in “ping google.com” will give you a constantly running checkup until you close the terminal window.
How to use Ping on Windows
Using Ping on Windows requires you to open Command Prompt. This can be done by either hitting Win + R, then typing in cmd into Run. However, a quicker way would be to use the Start menu, and type in “Command Prompt”.
Before you use Ping, make sure you have the IP address of the network device you’re checking. You can usually find this in your router settings.
Ping commands
Once you’ve got Command Prompt up, you can begin using Ping straight away. Remember to add Ping to the start of any commands to get the options working.
Typing in “ping” will give you a list of things you can do, like:
- Ping – Sends four echo request packets to the specified IP address or hostname and waits for replies.
- -t – Sends echo request packets to the specified IP address or hostname continuously until you press CTRL+C.
- -a – Resolves the IP address to a hostname before sending the echo request packets.
- -n count – Sends the specified number of echo request packets to the specified IP address or hostname.
- -l size – Sends echo request packets with the specified data size.
- -f – Sets the Don’t Fragment flag on the echo request packets.
- -i TTL – Sets the Time To Live (TTL) field in the echo request packets.
- -v TOS – Sets the Type of Service (TOS) field in the echo request packets.
- -r count – Sets the number of times to try to resend each echo request packet.
- -s count – Sends the specified number of echo request packets with a single IP header.
- -w – Sets the timeout value in milliseconds for each echo request packet.
- -R – Turns on reverse name resolution.
- -S srcaddr – Sets the source IP address for the echo request packets.
- -p – Sets the protocol for the echo request packets.
- -4 – Forces the use of IPv4.
- -6 – Forces the use of IPv6.
How to use Ping on Linux
Linux is a much more flexible operating system compared to Windows, but the commands for Ping are almost universal. Typing in Ping will give you a good list of what the Linux terminal can do, but these are some of the most common commands to use.
Linux commands
Remember to add the word “ping” to the front of these commands.
- ping – Sends four echo request packets to the specified IP address or hostname and waits for replies.
- -c count – Sends the specified number of echo request packets to the specified IP address or hostname.
- -i interval – Sends echo request packets at the specified interval.
- -l size – Sends echo request packets with the specified data size.
- -f – Sets the Don’t Fragment flag on the echo request packets.
- -v TOS – Sets the Type of Service (TOS) field in the echo request packets.
- -R – Turns on reverse name resolution.
- -S srcaddr – Sets the source IP address for the echo request packets.
- -w timeout – Sets the timeout value in milliseconds for each echo request packet.
- -4 – Forces the use of IPv4.
- -6 – Forces the use of IPv6.
Using ping on macOS
Similarly to Linux, the Unix base for macOS will give you the same results. However, Apple does have some specific commands that they list when just typing “ping” into the terminal.
Apple-specific commands
- : Binds the socket to the interface
- : Sets traffic class socket option
- : Sets traffic class socket options
- : Calls connect(2) in the socket
- : Displays the current time