Home Linux Commands How to Install and Use Ping Command in Linux

How to Install and Use Ping Command in Linux

PING is undoubtedly a millennial word. It’s rooted in quotidian life and henceforth has become a concept to be unveiled. Many of us might be known of the fact that the word ‘ping‘ is not actually a word but an acronym. PING stands for Packet Internet Groper. The meaning
says it all.

Pinging is a notion to observe the connectivity between two systems, to check whether the remote system is online. Technically, the word ping lies in the domain of network communication. It deals with the notion of transferring and accepting the packets from source to destination system.

[ You might also like: How to Change Network MAC Address in Linux ]

It is used to check the connectivity of systems by sending packets. Let’s say system A wishes to connect to system B. In this case, the A sends packets to B i.e A pings to B. System A can ping to B by either using its IP address or its hostname.

Pinging in Linux

Pinging in Linux is apparently an easy job to do until you have the command which performs this action for you. In Linux distribution, the pinging is done using the command “ping” followed by the IP address or hostname.

$ ping [option] [IP address / hostname]

To check the IP address of your Linux system, use the following command.

$ ifconfig
Check Linux IP Address
Check Linux IP Address

Next, try to ping the server using the IP address as shown.

$ ping 192.168.0.101
Ping Linux System
Ping Linux System

What Does a Packet Contain?

So far we know pinging purports to send packets. But what are these packets? These packets comprise the information along with a header. The header is the guiding light for this packet.

A packet header contains the source IP address and the destination IP address. It resembles the way you send postcards containing your address and your friend’s address. Once the packet reaches its destined location it responses back and that’s what we call “The systems are pinging“.

The ping command actually sends an echo request to the remote system. It uses ICMP (Internet Control Message Protocol) for the same. Whenever the two systems ping it is followed by some detailed specifications ranging from who is sending packets and at what time it reaches the destination.

$ ping facebook.com
Ping Domain Name
Ping Domain Name

The explanation of the above ping command.

  • icmp_seq – It is the number given to every request sent by the source.
  • ttl – Time To Live is the number of network nodes taken by the packet.
  • time – It represents the milliseconds taken by the packet to reach and come back again to the source.

How to Install Ping Command in Linux

By default, most Linux systems already have the ping command. Here, we consider the scenario that it does not, so we encounter this error on trying to ping with google.

$ ping www.google.com

bash: /usr/sbin/ping: No such file or directory

To install the ping command in Linux, use your system’s package manager as shown.

$ sudo apt install iputils-ping    [On Debian, Ubuntu and Mint]
$ sudo yum install iputils         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a net-misc/iputils  [On Gentoo Linux]
$ sudo pacman -S iputils           [On Arch Linux]
$ sudo zypper install iputils      [On OpenSUSE]    

Once the software has been installed you can successfully ping to any server. The process can be stopped using Ctrl+C.

$ ping www.google.com
Ping Google Domain
Ping Google Domain

In extension, the ping command offers some specific options that can also be tried and tested. To see additional command-line options:

$ ping help
Ping Command Help
Ping Command Help

This article was an overview of how to install and explore the ‘ping‘ command in the Linux servers. It also gave an insight into the real essence of pinging. In addition, it appends to the knowledge bucket of Linux.

Ping command is accompanied by varied options which can further be used to control, count, stop the packets transfer. Examine these commands and keep pinging. Do let us know how you find this article. Any views, suggestions are welcomed.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.