ping (Packet InterNet Groper)
The ping command is used to verify the reachability of a host on an Internet Protocol (IP) network and to measure the round-trip time (RTT) for messages sent from the originating host to a destination computer. It uses ICMP Echo Request packets to test connections.
[Image showing a ping command results with TTL and time in milliseconds]
1. Basic Usage
ping [options] [hostname or IP]
2. Key Options
| Option | Name | Description |
|---|---|---|
-c [count] |
count | Stops after sending a fixed number of ECHO_REQUEST packets. |
-i [interval] |
interval | Wait N seconds between sending each packet. |
-s [size] |
size | Specifies the number of data bytes to be sent. |
-t [ttl] |
ttl | Set the IP Time to Live. |
-v |
verbose | Verbose output. |
3. Practical Examples
① Testing a connection to a specific domain
ping linux.org
② Sending exactly 5 packets
ping -c 5 1.1.1.1
③ Flooding a local server (Careful!)
Sends packets as fast as they come back or one hundred times per second. Usually for stress testing.
sudo ping -f 192.168.1.1
4. [Tip] Understanding the Output
- time (ms): The latency. Lower is better (ideal for gaming or real-time apps).
- packet loss: If this is higher than 0%, it indicates a shaky or unstable connection.
- TTL (Time to Live): Prevents packets from circulating forever. Each hop (router) decreases this value.