UNIX ping Command Examples

The ping command in UNIX is used to test connectivity between two nodes in a network. It sends packets to the destination node and waits for a response. Here are some examples of how to use the ping command in UNIX:

  1. Ping a host by IP address:
    ping 192.168.1.1
  2. Ping a host by hostname:
    ping google.com
  3. Limit the number of packets to be sent:
    ping -c 5 192.168.1.1
  4. Set the time interval between sending packets:
    ping -i 1 192.168.1.1
  5. Set the size of the packet to be sent:
    ping -s 1000 192.168.1.1
  6. Ping continuously until stopped:
    ping -t 192.168.1.1
  7. Ping with a specific source IP address:
    ping -I 192.168.1.2 192.168.1.1
  8. Use verbose output to see all the ping results:
    ping -v 192.168.1.1
  9. Use a specific network interface to send the ping packets:
    ping -I eth0 192.168.1.1
  10. Use a specific type of service (TOS) field in the IP header:
    ping -Q 0x10 192.168.1.1

Leave a Comment