--- layout: page category-page: intermediate category-title: intermediate commands author: Joy Albertini tags: server ping latency UNIX title: ping ---
The ping
command , is used to test connection between a local server/computer to a remote UNIX server.
The ping command sends ICMP Echo Request packets to the remote server for accessing it.
Each packet echoed back (via an ICMP Echo Response packet) is written to the shell output.
Example; Device-name:Current-position username$ ping IP address; ping 192.168.3.2
Device-name:Current-position username$ ping Server_name; ping yahoo.com
The shell will output something like this: 64 bytes from 98.138.219.232: icmp_seq=0 ttl=49 time=144.781 ms for each packets that return (echoed back).
Important to stop the ping command press control + c.
ping 192.168.3.2
-c
send limited number of packets with ping -c (nr of packets) -n
avoid dns lookup, avoid to lookup symbolic names for host addresses, so only numeric output -a
get an audio warning, when the remote server comes online -b
Allow pinging a broadcast address (broadcast network, is a network with many devices on it).-m
(mark) tag the packets going out -f
(Flood ping) For every ECHO_REQUEST sent (.) is printed,
for every ECHO_REPLY received, a backspace is printed.
With this command you can easily understand how many packets are being dropped.-i
(interval) set the interval between seending each packet (defaultn 1 second); only super-user can set interval values less than 0.2 seconds -I
(interface-address) set souce adress to a specific interface adress, example the name of the device or IP. When pinging local adresses IPV6, is a needed flag
-l
(preload) ping send packets but don't wait for reply.(you need sudo = amministrator persmissions) -L
Remove loopback of multicast packets -N
(Nioption) send ICMpv6 request, instead of Echo requests ipv6
request Ipv6 adresses ipv4-all
request Ipv4 adresses -p
(pattern) specify up to 16 number to fill out the packets you send -D
print timestamp (unix time + microseconds) in each line-q
(Quiet output) Nothing displayed except the summary lines at the start and at the end.
Example: ping -q yahoo.com, shell Output initially PING yahoo.com (72.30.35.10): 56 data bytes, and nothig else
until you stop the ping command, and the shell will display the stats. -R (Record route), displays the route buffer on the packets that include RECORD_ROUTE in the ECHO_REQUEST.
-r bypass the normal routing in a directly-attached network
-s (packetsize) Specifies the data bytes to send (default is 56 that + 8 byte of ICMP = 64 ICMP data bytes)
Example: ping -s 33 yahoo.com; send packets of 33 + 8 ICMP = 41 bytes to yahoo.com.
-t set IP time-to-live (set how long execute ping in seconds)
Example: ping -t 3: the shell will ping yahoo.com for 3 seconds, and then stops.
-U print full user-to-user latency (legacy ping behaviour).
-v output verbose on output
-V Display verion of command
-w (deadline) Timeout in seconds of ping command, regardless of how many packets have been sent.
-W (timeout), time waiting for a response from the server, if the server dosen't reply in the time set, the ping command will stop.