This article was co-authored by wikiHow staff writer, Nicole Levine, MFA. Nicole Levine is a Technology Writer and Editor for wikiHow. She has more than 20 years of experience creating technical documentation and leading support teams at major web hosting and software companies. Nicole also holds an MFA in Creative Writing from Portland State University and teaches composition, fiction-writing, and zine-making at various institutions.
This article has been fact-checked, ensuring the accuracy of any cited facts and confirming the authority of its sources.
This article has been viewed 766,287 times.
Learn more...
The ping command is extremely helpful for troubleshooting and testing network speed and connectivity issues in Linux. Ping works by sending packets of data to an IP address or hostname and reporting how long it takes to receive a response. You can use the results of a ping test to figure out whether a site or server is reachable, and if so, whether there's any packet loss slowing things down. This wikiHow tutorial will teach you how to run the ping command in a Linux terminal, and how to understand ping results and statistics.
Things You Should Know
- The basic syntax for ping is ping <ip address>, where <ip address> is the address of another device.
- To ping an iPv6 IP address instead of an iPv4 address, you'll use ping -6 <ip address>.
- "Destination host unreachable" means the host is down or that there is no route from your Linux computer to that host.
- "Request timed out" sometimes indicates problems on the remote computer or network, but could also just mean that there's a firewall blocking the connection.
Steps
How to Ping
-
Open a Terminal window. You can do this on most versions of Linux, including Ubuntu, by pressing Ctr + Alt + T. You can also double-click the Terminal app icon in your app list.
-
Run a basic ping. At the prompt, type ping followed by the IP address, hostname, or domain name that you want to test. When you press Enter, you'll see the echoed results as individual entries.
-
Basic ping examples:
- To ping a website like Facebook, you'd type ping www.facebook.com or ping facebook.com.
- To ping an IPv4 IP address, such as 10.0.0.1, you'd type ping 10.0.0.1.
- To ping an IPv6 IP address, you'll add the -6 option. To ping Facebook's IPv6 address, you'd use ping -6 2a03:2880:f02c:13:face:b00c:0:3.
- You can also ping your own computer (localhost) to make sure your network adapter is working property. To do this, you'd use ping localhost or ping 127.0.0.1.
- For more ping examples, see Advanced Ping Examples.
-
Basic ping examples:
-
Press Ctrl+C to stop the ping. In Linux, the ping command will continue to display echo results until you stop the process with this keyboard shortcut. Once you stop the ping, you'll see a statistics summary of the ping right above the prompt.
Community Q&A
-
QuestionFrom root, can we ping others in Linux?Community AnswerYes, in root or regular user you can.
-
QuestionHow do I stop my machine from pinging other machines?Community AnswerIn a command prompt, press "Ctrl + C" to end processes in a command line. If you are not actively doing it in a command line, see if your computer is connected to a network or VPN. If not, try to find which kind of device it's pinging and where it is located. If all else fails, either it's nothing or you are being watched/hacked.
-
QuestionHow to stop a Linux Mint PC once you have used the ping command?Community AnswerCntrl + C will stop the ping if you ever start it. You can do the same to stop just about any process in Linux if you started it via command.
Video
Tips
-
The "ping" command as it's written here can also be used verbatim in the Command Prompt on Windows and the Terminal on Mac.Thanks
Warnings
- Not all websites will allow you to ping their true addresses, so your ping results might not always be accurate.Thanks
References
- ↑ https://www.intel.com/content/www/us/en/gaming/resources/how-to-fix-packet-loss.html
- ↑ https://developer.mozilla.org/en-US/docs/Glossary/Round_Trip_Time_(RTT)
- ↑ https://www.oreilly.com/library/view/linux-shell-scripting/9781785881985/bc450563-0a16-40a7-90f4-cad57506a501.xhtml
- ↑ https://manpages.ubuntu.com/manpages/trusty/man8/ping.8.html
- ↑ https://www.ibm.com/docs/en/aix/7.2?topic=p-ping-command
- ↑ https://manpages.ubuntu.com/manpages/trusty/man8/ping.8.html
About This Article
1. Press Ctrl+Alt+T to open the terminal.
2. Type "sudo ping -v" to install Ping Version
3. Type "Ping" followed by the website or IP address you want to ping.
4. Press Enter.