ping - Linux


The ping command is a network utility used to test the availability of a host on an IP network. It operates by sending Internet Control Message Protocol (ICMP) Echo Request messages to the target host and listens for Echo Reply messages. Its primary use is for troubleshooting network connectivity issues and for performance measurement.


ping [options] destination
  • destination: This can be either an IP address or a hostname to which the ICMP Echo Requests are sent.


  • -a: Audible ping. Play a beep sound for each response received.
  • -c count: Stop after sending (and receiving) count ECHO_RESPONSE packets.
  • -i interval: Wait interval seconds between sending each packet. The default is 1 second.
  • -s packetsize: Specifies the number of data bytes to be sent.
  • -t ttl: Set the IP Time to Live.
  • -q: Quiet output. Only display the summary lines at startup time and when finished.
  • -l preload: Send preload number of packets as fast as possible before falling into the normal rate of sending (only as superuser).
  • -f: Flood ping. Outputs packets rapidly (only as superuser). Very high rate ping, useful for stress tests.
  • -w deadline: Specify a deadline in seconds by which the command will terminate regardless of how many packets have been sent or received.


  • Basic ping:


    Sends ICMP packets to until interrupted.

  • Ping with count:

    ping -c 4

    Send exactly 4 packets to and then exit.

  • Specifying packet size:

    ping -s 100

    Sends packets of 100 bytes to

  • Ping with deadline:

    ping -w 10

    Continue to send packets to for 10 seconds.

Common Issues

  • Permission denied: Without superuser rights, the -f (flood) option might fail.
  • Network is unreachable: Indicates a problem with the local network configuration; check your network settings and interfaces.
  • Unknown host: The DNS resolution for the destination failed; verify the hostname and DNS settings.


Combining ping with grep:

ping -c 10 | grep 'bytes from'

This command pings 10 times, but only outputs the lines indicating responses.


for ip in {1..10}; do
  ping -c 1 "192.168.0.$ip"

Pings 10 hosts in a local subnet and checks their availability.

  • traceroute: Trace the route packets take to a network host.
  • netstat: Display network connections, routing tables, interface statistics, and more.
  • nc (netcat): Utility for reading from and writing to network connections.

Further reading:

  • Visit Ping Man Page for more in-depth details on usage and options.