Home » Linux

Explain ping in Linux - How to ping an IP address in Linux?

Learn: What is ping command in Linux, how it can be used to ping an IP address in Linux Operating System? Options of ping command.

Ping stands for Packet Internet Groper. This is a Linux terminal command, which is used to check network connectivity.

It will work for all networks like: LAN, MAN, WAN etc.

Ping command uses ICMP protocol to check particular node is reachable or not.


$ping  -<options>  <hostname>


$ping  www.google.com

If network is reachable, then output of ping command:

linux~# ping 
PING ( ) 56(84) bytes of data. 
64 bytes from : icmp_req=1 ttl=64 time=0.477 ms 
64 bytes from : icmp_req=2 ttl=64 time=0.157 ms 
64 bytes from : icmp_req=3 ttl=64 time=0.284 ms 
64 bytes from : icmp_req=4 ttl=64 time=0.285 ms 
64 bytes from : icmp_req=5 ttl=64 time=0.288 ms 

If network is not reachable, then output of ping command:

linux~# ping 
PING ( 56(84) bytes of data. 
From icmp_seq=1 Destination Host Unreachable 
From icmp_seq=2 Destination Host Unreachable 
From icmp_seq=3 Destination Host Unreachable

Options of Linux - ping command

These are some of the important options, which is used with ping command:

  1. -d
    This option is used to set socket option SO_DEBUG
  2. -l
    When source route was lost then we use this option in our IP header to send the packet to the given host.
  3. -n
    It shows network addresses as numbers. Normally when we use ping command, it displays addresses as host names.
  4. -I (interval)
    It specifies the interval between two transmissions. By default, it is one second.

Comments and Discussions!

Load comments ↻

Copyright © 2024 www.includehelp.com. All rights reserved.