Network has its fair share of weird issues, especially when you are dealing with Linux but learning network troubleshooting is crucial, and one of the basic yet most powerful commands that you have is ping. Ping is a powerful and invaluable tool that anyone using Linux should learn to master, whether you’re attempting to check connectivity, troubleshoot network issues, or simply test the responsiveness of different servers. But what is “ping in Linux” in the first place?
At its core, the ping command on Linux sends ICMP Echo Request messages to the target host, and the target sends back Echo Reply messages. Hence this is a procedure to check if the network connection between your machine and the target machine is working fine. If you are a Linux user then you will need to use the ping command effectively so that your system is at an optimum connection with the internet or a local network.
In this article, we will examine how to ping in Linux, a range of ways to execute the ping command, how to stop pinging (when needed), and additional key tips for your network troubleshooting. We hope this information is useful to all those new or seasoned sysadmin who have not yet fully utilized the power of the ping command in the Linux environment.
What is Ping in Linux?
The ping Linux tool is a command-line tool in Linux that allows end users to test whether a given host (like a website, server, or router) is reachable from their system over a network. It is commonly used to help troubleshoot network issues or to check whether a particular address or device can be reached over the internet or local network.
Ping measures the round-trip time it takes for a target device to return an Echo Reply when it receives an ICMP Echo Request packet. This RTT receives tenders important information about the speed and latency of the network usage of the users, which can therefore be useful to diagnose slow connections or instances of network congestion.
Ping Syntax in Linux
ping [options] destination
The destination can be an IP address or a hostname.
Get exclusive access to all things tech-savvy, and be the first to receive
the latest updates directly in your inbox.
For example:
ping google.com
This will ping the Google servers and let you see the results of the request and reply times.
Linux Ping Command: Usage Explained
Ping Command in Linux The ping command in Linux is very simple, but it has many options that can help us change the behavior of the command. Here’s what you need to know about using it:
Ping Specific IP: To ping an IP address or hostname, type:
ping 8.8.8.8
or
ping google.com
This would ping the mentioned ip address or hostname and return the statistics of packets send and received.
How to Limit the Number of Pings:
By default, the ping command will run indefinitely until stopped manually. To specify just the number of pings to send use the -c option followed by the number you wish to send:
ping -c 5 google.com
This will ping Google 5 times and stop.
Ping with Specific Size of a Packet — You can send the packet of the specific size using the -s option:

ping -s 100 google.com
This will send it 100-byte packets.
Set Timeout for Each Ping: You can also set a timeout limit for each ping response using -W option:
ping -W 2 google.com
This is used to set the timeout for each response to be 2 seconds.
Output of Ping Command:
PING google.com (172.217.16.142) 56(84) bytes of data.
64 bytes from 172.217.16.142: icmp_seq=1 ttl=113 time=15.6 ms
64 bytes from 172.217.16.142: icmp_seq=2 ttl=113 time=16.1 ms
64 bytes from 172.217.16.142: icmp_seq=3 ttl=113 time=15.4 ms
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 15.413/15.650/16.142/0.265 ms
How to Stop Ping in Linux
However, there are occasions when you might want to stop pinging during troubleshooting or when the command runs for a long time. On a ping command running in Linux, you can stop it by pressing Ctrl + C.
This will stop the ping process and you’ll see a summary of the packets sent and received, including statistics such as packet loss and round-trip time.
A similar approach is also possible for stopping the ping command after some number of attempts which we discussed above with the -c option.
How to Ping in Linux: Advanced Options
The Linux ping command has a lot of advanced options that can be useful in networking and diagnostic tasks. Here are examples of more commonly used options:
Ping with a certain period:
Use the -i option to set an interval between pings:
ping -i 2 google.com
The command will ping the server every 2 seconds.
Flood Ping:
The -f option is used in the case of flood ping, and it sends the ping as fast as possible to measure performance under load:
ping -f google.com
WARNING: This can flood some networks or systems, be careful.
Ping with Extended Output:
The -v option will provide more verbose output with detailed packet information:
ping -v google.com
CyberPanel Role for Ping in Linux

CyberPanel is a robust web hosting control panel by Linux where you can manage your Linux server in a much easier way. CyberPanel is very useful for Linux servers, especially when you try to make changes in the network settings or troubleshoot something. It enables users to quickly configure DNS settings, track network activity and set up firewall settings — all of which impact what a ping test will return.
For instance, if it’s your case that you’re pinging your server and you’re not getting any response back, CyberPanel can help you check if you’ve blocked ICMP requests in your firewall settings as that could be the culprit. It offers a unified interface between the server space and networking, making network management easy.
FAQs: Command Ping In Linux
1. By default, how does the ping command work in Linux?
The default behavior is to send the ping requests indefinitely until it is manually halted. Use -c option to limit the number of requests.
2. Can I ping a device on another network?
Indeed, provided that the device is accessible over the network. Windows Firewall: make sure the firewall allows ICMP requests.
3. What does TTL in ping results mean?
TTL is the number of hops a packet can traverse before it is dropped. It shows how many devices that packet can traverse.
4. How to ping multiple hosts in Linux?
You can run multiple ping commands at the same time or use a script to ping multiple hosts one after another.
5. Ping is not working in Linux, what to do?
If the ping command is not returning results, you may have a firewall blocking ICMP requests, or have network or DNS configuration issues.
Ping in Linux for Networking Troubleshooting: A Summary
The ping command is an invaluable tool for users and administrators of Linux-based systems, with options ranging from basic pinging to advanced features for targeted control. Whether you are checking connectivity, measuring latency, or diagnosing network issues, understanding the ins and outs of ping will help guide you confidently through the world of Linux networking.
Keep playing with the ping command, and keep discovering options: if you want to improve your networking skills. If you’re interested in more control over your Linux server’s network settings, try integrating tools such as CyberPanel into your routine.
Ping now, and step up your Linux skills!