Linux Terminal Command: ping

The ping command is an essential tool in Network Utilities. In this tutorial, we will explore what ping does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The ping command uses ICMP packets to test whether a remote server is reachable and measures packet transmission round-trip times.


Common Options & Syntax

ping [options] [arguments]

Here are the most common flags used with ping:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
ping google.com

What it does: Pings ‘google.com’ continuously until stopped with Ctrl+C.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
ping -c 5 -i 0.2 -W 1 1.1.1.1

What it does: Pings the IP address exactly 5 times (-c 5), spacing packets by 0.2 seconds (-i 0.2), and sets a 1-second request timeout (-W 1).


⚙️ Warning & Common Pitfalls

[!WARNING] Some firewalls block ICMP packets. A host may be online and running web services even if it fails to respond to ping requests.


Here are some related posts on cli_tty1 you might want to check out: