bash: ping: command not found: How to Install on Linux

One of the most common networking tools used in Linux is ping. However, if you encounter the error -bash: ping: command not found, it means that the ping utility is not installed or is missing from your system’s PATH. In this tutorial, we will show you how to install the ping command on different Linux distributions.

In this tutorial you will learn:

  • How to install the ping command on different Linux distributions
  • How to verify that ping is installed correctly
  • How to use ping to test network connectivity
bash: ping: command not found: How to Install on Linux
bash: ping: command not found: How to Install on Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distribution
Software iputils-ping or ping package
Other Internet connection required for installation
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Installing the Ping Command

The ping utility is usually included in the iputils package, but some minimal installations may not include it by default. Below are the steps to install it on different Linux distributions.

PING NOT AVAILABLE BY DEFAULT ON UBUNTU SERVE
On Ubuntu Server, the ping command is not available by default because the package that provides it, iputils-ping, is not included in minimal installations. This is done to reduce the system’s default footprint and enhance security by limiting unnecessary tools. In environments like cloud instances or containers, network diagnostic utilities are often excluded to minimize attack surfaces. As an alternative, users can check network connectivity using commands like traceroute, nc (netcat), or curl to diagnose network issues without ping.

  1. Install Ping: To install the ping command, follow the instructions for your Linux distribution:
    • Debian-based Systems (Ubuntu, Linux Mint):
      sudo apt update && sudo apt install iputils-ping
    • RHEL-based Systems (CentOS, Rocky Linux, AlmaLinux):
      sudo yum install iputils
    • Arch Linux:
      sudo pacman -Sy inetutils
  2. Checking Ping Version: Verify that ping is installed by checking its version:
    ping -V
  3. Testing Network Connectivity with Ping: Confirm that ping is working by testing it with Google’s public DNS server:
    ping 8.8.8.8

Conclusion

In this guide, we covered how to install the ping command on various Linux distributions, verify its installation, and use it to test network connectivity. The ping command is an essential tool for network troubleshooting, so ensuring it is installed on your system is crucial.