--- 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.
Usage:
Example:
ping 192.168.3.2
ping yahoo.com
control + c
ping [-flag] server
-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) -t
set IP time-to-live (set how long execute ping in seconds) -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.