---
title: ping Command Cheatsheet
description: "# Guide to the `ping` Command in Linux The `ping` command is a fundamental tool in Linux for checking network connectivity. It sends ICMP packets to a specified IP address or domain and measures the response time, helping diagnose connectivity…"
url: "https://www.relianoid.com/resources/knowledge-base/misc/ping-command-cheatsheet/"
updated: "2025-05-27"
category: Misc
---

# ping Command Cheatsheet

# Guide to the `ping` Command in Linux

The `ping` command is a fundamental tool in Linux for checking network connectivity. It sends ICMP packets to a specified IP address or domain and measures the response time, helping diagnose connectivity issues.

## Basic Syntax of the `ping` Command

The command syntax is as follows:

`ping [OPTIONS] DESTINATION`

- **OPTIONS**: Flags to modify the command’s behavior, such as the number of packets, size, or interval.
- **DESTINATION**: The IP address or domain you want to ping.

## Option Table for the `ping` Command

| Option | Description |
| --- | --- |
| `-c COUNT` | Sends a specific number of packets (e.g., `ping -c 4 google.com` sends 4 packets). |
| `-i INTERVAL` | Sets the interval between packets in seconds (e.g., `ping -i 2 google.com` sends a packet every 2 seconds). |
| `-s PACKET_SIZE` | Specifies the packet size in bytes (e.g., `ping -s 128 google.com` sends 128-byte packets). |
| `-W TIMEOUT` | Sets the maximum time to wait for a response, in seconds (e.g., `ping -W 5 google.com` waits up to 5 seconds for a response). |
| `-q` | Quiet mode: displays only a summary at the end, omitting per-packet results. |
| `-f` | Flood ping: sends packets as fast as they are received (requires superuser privileges). |
| `-l PRELOAD` | Preloads a specific number of packets before starting the sequence (e.g., `ping -l 3 google.com` sends three packets immediately). |

## Examples of Using the `ping` Command

Here are some common examples of the `ping` command:

### Basic Ping

`ping google.com`

This command sends ICMP packets to `google.com` continuously until stopped with `Ctrl + C`, showing the round-trip time for each packet.

### Send a Specific Number of Packets

`ping -c 5 google.com`

Sends 5 ICMP packets to `google.com` and then ends automatically, providing a summary.

### Set Packet Size

`ping -s 100 google.com`

Sends 100-byte packets to `google.com` instead of the default 56 bytes.

### Specify Interval Between Packets

`ping -i 2 google.com`

Sends a packet every 2 seconds, helpful for longer tests or reducing network load.

### Quiet Mode

`ping -q -c 10 google.com`

Sends 10 packets and displays only the summary, omitting per-packet details.

## Interpreting Ping Results

When executing the `ping` command, typical output includes the following:

- **Round-Trip Time (time)**: The time it takes for a packet to reach the destination and return. High values can indicate latency issues.
- **Packets Sent/Received**: Displays the packet loss percentage, useful for identifying connectivity problems.
- **TTL (Time To Live)**: Indicates the maximum number of hops a packet can take. A low TTL may indicate many network hops.

## Summary

The `ping` command is essential for checking network connectivity and diagnosing basic connection issues in Linux. With multiple options, it enables customized ICMP packet sending for testing latency, network stability, and device availability on a network.

### 📄 Download this document in PDF format
