How to Install Ping Command on Ubuntu Linux
The ping command tests a network connection. It sends small data packets to another device and measures how long the replies take. Fresh Ubuntu installations, minimal server images and lightweight Docker containers (isolated environments that share the host system’s kernel) often leave this tool out. When that happens, the terminal answers with a “command not found” error.
The fix is one short install, because the tool lives inside the iputils-ping package. Once the package is installed, you can check connection speed, see whether a host is reachable and troubleshoot network drops right away. The whole job takes about a minute on a normal connection.
Install the iputils-ping package using the command sudo apt install iputils-ping. This package provides the ping utility, which is essential for testing network connectivity on Ubuntu. After installation, you can use ping to diagnose network issues.
Install ping command
To install ping on Ubuntu, open your terminal and run sudo apt update, followed by sudo apt install iputils-ping. The package contains the network testing tools you need. It fixes the missing command error that often shows up on minimal Ubuntu setups, cloud servers and Docker containers.
- Open a terminal. On Ubuntu Desktop, press Ctrl+Alt+T. On a server or cloud instance, connect over SSH or use the console.
- Run sudo apt update to refresh the package lists. You should see a list of repositories being checked, ending with a line that tells you how many packages can be upgraded. In a fresh Docker container this step matters most, because the package lists are often empty and the install fails without it.
- Run sudo apt install iputils-ping to install the package. Type your password when asked. Nothing appears on screen while you type, which is normal.
- Press Y and then Enter if apt asks you to confirm. You should see the package download and unpack, and then the prompt returns.
You need a user with sudo rights for these commands. Inside most Docker containers you already run as root and sudo is not installed, so leave sudo off and run the same commands without it. If apt reports it cannot find the package, check that the container or server has internet access and that the apt update step finished without errors.
Installing the iputils-ping package solves the missing tool problem on minimal setups and in container environments. Desktop versions of Ubuntu normally include it already, so you will mostly need this step on server images, cloud instances and containers. If the package is already installed, apt tells you it is the newest version and changes nothing, so running the command again does no harm.
sudo apt install iputils-ping
Test your connection to confirm the installation works. Run ping in the terminal. If the install worked, the “command not found” error is gone and you see reply lines that include the response time in milliseconds.
On Linux, ping keeps sending packets until you stop it, unless the command you ran limits the count. Press Ctrl+C to stop it. The summary at the end shows how many packets were sent and received and the percentage lost. Replies with 0% packet loss mean the connection is healthy. If you see 100% packet loss, the host may be down, or a firewall may be blocking ping requests. If a numeric IP address answers but a domain name does not, the problem is most likely DNS rather than the connection itself.
ping localhost
Network diagnostics are now ready for daily use. You can run ping whenever a site will not load, a server seems slow or a container cannot reach the outside world, and use the replies to see where the problem starts.
Conclusion:
- The
pingcommand is a vital network utility for testing connectivity in Ubuntu Linux. It shows whether another device answers and how fast. - Installing the
iputils-pingpackage is necessary to use thepingcommand in minimal Ubuntu editions or Ubuntu running as a Docker container. Run sudo apt update first so the package can be found. - Verifying network connectivity using
ping localhostconfirms that the installation was successful and shows whether the connection itself is working.
Have a question about this guide?
Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.
Did this guide fix your problem?
About the Author
Richard
Tech Writer, IT Professional
Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.
No comments yet — be the first to share your thoughts!