Linux Command - ping
The ping command in Linux is used to test network connectivity between your machine and another host. It sends ICMP Echo Request packets and reports back the latency and packet loss.
Continuously ping a host:
- To stop pinging use CTRL - C.
ping google.com # Continuously ping a host
ping 192.168.3.1 # Continuously ping an IP
Ping a host 5 times, every half second and then stop:
ping -c 5 -i 0.5 google.com
Common options:
-c 5 # Send only a specific number of packets (e.g. -c 4)
-i 0.5 # Interval between packets (default is 1 second)
-t 2 # Set the TTL (Time To Live) for packets
-s 128 # Set the number of bytes in the packet payload
-q # Quiet mode (summary only)
-4 # Force IPv4
-6 # Force IPv6