How to Ping an IP Address in Ubuntu Terminal

The Connectivity Diagnostic Vector

When an Ubuntu Linux server suddenly loses access to the internet, or when a specific database node goes offline, the administrator must immediately determine the exact point of failure. You must diagnose whether the physical network cable is unplugged, the router is down, or the external website itself has crashed. The absolute most fundamental diagnostic tool for testing network connectivity is the packet internet groper, universally known as the ping command.

How to Ping an IP Address

The ping command fires tiny packets of data at a target IP address and measures exactly how long it takes for the target to respond.

1. Open your terminal application or connect to your server via SSH.
2. To test if your server can successfully reach the outside internet, ping a highly reliable external server (like Google’s public DNS). Execute:

ping 8.8.8.8

3. The terminal will immediately begin outputting data lines. Each line represents a successful round trip. You will see time=14.2 ms, indicating the connection is healthy and fast.
4. Crucial Warning: Unlike Windows, the Linux ping command will run infinitely until you manually stop it. To force the command to terminate and display the final summary statistics, press Ctrl + C on your keyboard.
5. If you want the command to automatically stop after exactly four pings (mimicking the default Windows behaviour), you must use the -c (count) flag:

ping -c 4 8.8.8.8

If the output states “Destination Host Unreachable” or “100% packet loss,” you have definitively proven that your server’s network connection is severed.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.