ping command Ubuntu
Installation

Install ping Command on Ubuntu

Sagar Sharma
Sagar Sharma

Table of Contents

If you're running an extremely minimal install of Ubuntu or using Ubuntu as a Docker, then you may encounter such a situation where the ping command won't be installed.

And when you try to use the ping command, it will throw the following error:

Ping command not found

So in this tutorial, I will walk you through how you can install the ping command in Ubuntu.

How to install ping in Ubuntu

Even if you try to install ping using sudo apt install ping, it will show an error saying Package 'ping' has no installation candidate:

root@LU-Docker:/# apt install ping
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package ping is a virtual package provided by:
  inetutils-ping 2:2.2-2
  iputils-ping 3:20211215-1
You should explicitly select one to install.

E: Package 'ping' has no installation candidate

The reason is simple! There is no package called ping in apt repo and this is why it gave you an error.

And to install ping, you have to install a package called iputils-ping using the following command:

sudo apt install iputils-ping

Once done, you can use the ping command to check whether the host is up or not:

ping host-IP

For example, here, I used LU as the target:

ping learnubuntu
root@LU-Docker:/# ping learnubuntu
PING learnubuntu (192.168.1.8) 56(84) bytes of data.
64 bytes from Learnubuntu.bbrouter (192.168.1.8): icmp_seq=1 ttl=63 time=0.328 ms
64 bytes from Learnubuntu.bbrouter (192.168.1.8): icmp_seq=2 ttl=63 time=0.468 ms
64 bytes from Learnubuntu.bbrouter (192.168.1.8): icmp_seq=3 ttl=63 time=0.483 ms
64 bytes from Learnubuntu.bbrouter (192.168.1.8): icmp_seq=4 ttl=63 time=0.487 ms

To stop the ping, you can use Ctrl + c.

There is a similar traceroute command that lets you trace the path instead of just pinging it.

How to Install and Use Traceroute on Ubuntu
Learn what traceroute is, how to install it in Ubuntu and some practical examples of using this networking command.

Learn how to use the ping command

After the installation, learning the basics of a ping command is a good idea.

And if you don't know, it can also be used apart from checking whether the host is up or not. Here are various ways to use the ping command:

Linux Ping Command: 7 Practical Examples
Here are some of the most common usages of ping command in Linux along with their explanation.

I hope you will find this guide helpful.



Sagar Sharma

Sagar Sharma

A software engineer who loves to tinker with hardware till it gets crashed. While reviving my crashed system, you can find me reading literature, manga, or watering my plants.