ping - macOS


ping is a network utility that sends echo requests to a specified host to determine if it is reachable and to measure the time it takes for packets to travel between hosts.


ping [options] <destination-address> [duration]


  • -a: Resolve the hostname to an IP address
  • -c : Number of echo requests to send (default: 10)
  • -i : Time between echo requests in milliseconds (default: 1000)
  • -s : Size of the echo request in bytes (default: 56)
  • -t: Send echo requests indefinitely
  • -v: Verbose output
  • -w : Maximum time to wait for a response in milliseconds (default: 1000)


  • Simple usage: Ping Google’s DNS server
  • Specify request count and interval: Send 5 echo requests with a 500ms interval
ping -c 5 -i 500
  • Resolve hostname to IP address: Ping a website by its hostname
ping -a
  • Indefinite ping: Keep sending echo requests until stopped
ping -t

Common Issues

  • Destination unreachable: The host is not reachable, or the network is experiencing problems.
  • Request timed out: The host did not respond within the timeout specified.
  • High latency: The response time is unusually high, indicating network congestion or other issues.


ping can be integrated with other commands for advanced tasks:

  • Traceroute: Trace the path of packets to a host
traceroute `ping -a <destination-address>`
  • Port scanning: Check if a specific port is open on a host
nc -w 1 -z `ping -a <destination-address>` <port-number>
  • traceroute: Trace the path of packets to a host
  • nc: Network utility for testing network connectivity
  • nslookup: Lookup DNS information about a host