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