How To Fix “bash: ping: command not found” in Ubuntu

The ping command is used to troubleshoot the network connections but sometimes while using the ping command, users face the error of “bash:ping: command not found”. There are multiple reasons why this error is displayed on the screen. 

In this blog, the common reasons behind this error have been explored as well and the methods to fix it have been explained. 

What are the Common Reasons for the “bash:ping: command not found” error?

The most common reasons for this error are:

  • The package of the ping command utility is not installed
  • Missing the “ping” in the $PATH environment variable
  • The package of the ping command is corrupted
  • The package is not accessed with the sudo privileges

What are the Methods to Fix “bash: ping: command not found” in Ubuntu?

This error can be fixed by using any of the below-mentioned methods:

  1. Verify command availability
  2. Installing the iputils-ping package
  3. Checking the $PATH Environment Variable
  4. Reinstall the iputils-ping package

Method 1: Verify the Command Availability

First, confirm the ping command is being installed and its location is in the $PATH by running the command:

$ whereis ping

The path shown in the output can be used to run the ping command.

Method 2: Installation of the iputils-ping Package

Another reason for the ping command not being found is that the iputils-ping package has not been installed. This package can be installed by executing the command:

$ sudo apt install iputils-ping -y

Method 3: Checking the $PATH Environment Variable

If the package is installed but it is not available in the $PATH variable, then it will not work. To add it to the $PATH environment variable, run the command:

$ export PATH=$PATH:/usr/bin

The ping command has been successfully added to the $PATH environment variable. 

Method 4: Reinstall the iputils-ping Package

The last method to fix this error is by reinstalling the iputils-ping package. It will fix the broken packages if any and also update the package. To reinstall the iputils-ping package, run the command:

$ sudo apt --reinstall install iputils-ping -y

The package is reinstalled on Ubuntu. 


To fix the “bash:ping: command not found” error in Ubuntu, make sure the package is installed and it is located in the $PATH environment variable. The methods of this error with its most common reasons have been explained in this post.