Command library / ping
ping
Test whether a host is reachable
Sends ICMP echo requests to a host and reports whether (and how fast) it answers. On Linux ping runs forever until you stop it (Ctrl+C) unless you limit the count with -c — worth remembering before you ping something in a live demo.
Practice pingUsage
Options and flags
hosthost name or IP address to test
-cNsend exactly N packets then stop (default: forever)
-iSECONDSseconds between packets (default: 1)
-WSECONDStimeout in seconds to wait for each reply
Examples
ping -c 4 8.8.8.8Send exactly 4 packets to Google's DNS and stop — the classic 'is the internet up' check.
ping -c 1 10.0.0.5One packet: does this specific host answer at all?
ping -c 4 -i 0.2 10.0.0.5Four packets sent quickly, 0.2 seconds apart, for a faster read.
Common mistakes
ping always needs a target host or IP address as its last argument — without one there's nothing to send packets to.