1. Home
  2. Servers
  3. How to do a continuous ping in Windows, Linux, and MacOS

How to do a continuous ping in Windows, Linux, and MacOS

Continuous ping in Windows 7, 8, and 10

Step 1: Open the Windows command prompt. One way of doing this is by entering the key combination Windows + R and enter the command CMD.

Step 2: Enter the command line ping with the -t option and any address and confirm by clicking [Enter].

ping -t www.1-grid.com

For each incoming response packet, ping issues an entry on the standard output (stdout). The output comprises the IP address of the pinged computer, the size (in bytes) of the response packet, the response time in milliseconds (ms) as well as the TTL (Time to live).

To stop the ping, use [Ctrl] + [C].

If you stop the ping, the program displays a statistical summary (ping statistics) at its conclusion.

If needed, you can redirect the standard output to a text file. To do so, you add the appropriate operator (the greater-than symbol) as well as the file name (including the extension).

ping -t www.1-grid.com > c:pingtest.txt

If no file is found under the specified file name, it will be automatically generated. In the example presented above, we redirect the standard output to a txt file named pingtest.

Continuous ping in Linux

Step 1: Open the terminal for your Linux distribution in Ubuntu. One way to do this is with the key combination [Ctrl] + [Alt] + [T] (Genome, KDE).

Step 2: Enter the ping command and the target computer’s address in the command line and confirm by hitting [Enter].

ping 93.184.216.34

Continuous ping in Linux terminal

If you’d like to have the continuous ping issue a timestamp, use ping with the -D option. In this case, the output for each incoming response packet is preceded by a UNIX timestamp.

ping -D 93.184.216.34 > logfile.txt


Continuous ping with timestamp

If you don’t want to run ping on an endless loop in Linux, define the ping quantity with the -c option according to the following example.

Ping -c 4 93.184.216.34

Continuous ping in MacOS

Step 1: Open the terminal. You’ll find the Mac terminal under “Applications” in the subfolder “Utilities”.

Step 2: Run the ping command with the address of the target computer.

ping 93.184.216.34

Continuous ping in MacOS

In MacOS, you redirect the standard output according to the same procedure you would use in Linux and Windows.

ping 93.184.216.34 > logfile.txt

Run a ping test as you would in Linux with a user-defined quantity of echo request queries by choosing option -c.

Ping -c 4 93.184.216.34

Updated on October 19, 2023

Was this article helpful?

Related Articles