How to use the ping command in Linux
Ping is a program that is used to test the reachability of a host. It also measures the time it takes to send the packet and receive one. It does this by sending a ICMP echo request packet and waiting for a reply. Pretty much all Linux flavours will come with Ping pre-installed.
How to ping using a specific interface
$ ping -I wlan0 google.com
This will ping google using the wlan0 interface
How to send a certain amount of ping requests
$ ping -c 4 google.com
This will send 4 ICMP echo requests to google
How to change the timeout of a ping
$ ping -w 5 google.com
This changes the timeout of the ICMP request to 5 seconds.
How to ping yourself to check your interface is working
$ ping 0
or
$ ping 127.0.0.1
or
$ ping localhost
They all essentially do the same thing which is ping yourself.
Most ping output should look something like this:
$ ping google.com
PING google.com (142.250.77.46): 56 data bytes
64 bytes from 142.250.77.46: icmp_seq=0 ttl=118 time=3.459 ms
64 bytes from 142.250.77.46: icmp_seq=1 ttl=118 time=3.106 ms
64 bytes from 142.250.77.46: icmp_seq=2 ttl=118 time=5.924 ms
64 bytes from 142.250.77.46: icmp_seq=3 ttl=118 time=79.037 ms
64 bytes from 142.250.77.46: icmp_seq=4 ttl=118 time=6.458 ms
64 bytes from 142.250.77.46: icmp_seq=5 ttl=118 time=37.407 ms
^C
--- google.com ping statistics ---
6 packets transmitted, 6 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 3.106/22.565/79.037/27.957 ms