{"id":15883,"date":"2019-03-07T09:11:08","date_gmt":"2019-03-07T09:11:08","guid":{"rendered":"https:\/\/www.hostinger.com\/tutorials\/?p=15883"},"modified":"2026-03-09T19:19:42","modified_gmt":"2026-03-09T19:19:42","slug":"linux-ping-command-with-examples","status":"publish","type":"post","link":"\/ng\/tutorials\/linux-ping-command-with-examples","title":{"rendered":"How to use the Linux ping command: main usage ways and tips"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>The Linux <strong>ping <\/strong>command is a tool for diagnosing connectivity issues, monitoring network performance, and checking server availability. It is pre-installed in most distributions and accessible via Terminal or an SSH client.<\/p><p>The ping command works by sending Internet Control Message Protocol (ICMP) packets to a specified address. If the target server returns an ICMP echo reply, it is connected to the network.<\/p><p>This tutorial will explain the Linux ping utility, including its syntax, options, and common use cases. You will also learn to read ping command results to troubleshoot connectivity issues in your virtual private server (VPS).<\/p><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/Linux-Commands-Cheat-Sheet.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/public\" alt=\"\" class=\"wp-image-69262\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/Linux-cheat-sheet.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><\/div><p>\n\n\n<div class=\"protip\">\n                    <h2 class=\"featured-snippet title\">What Is the Ping Command in Linux?<\/h2>\n                    <p><br>\nThe Linux ping command, or packet internet groper, is a utility for diagnosing network issues in a server or network. It works by sending the target device a data packet and waiting for the response. Network administrators can modify the ping behavior using various options. For instance, you can set the number of packets sent and change the intervals.<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-ping-command-syntax-and-options\">Ping Command Syntax and Options<\/h3><p>ping is commonly pre-installed on most Linux operating systems. To check if your system has it, query the installed ping version using this command:<\/p><pre class=\"wp-block-preformatted\">ping -V<\/pre><p>If ping is installed, you will see the version number. Otherwise, Terminal will return the <strong>command not found<\/strong> error.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/Ping-version-output-in-Terminal.png\"><img loading=\"lazy\" decoding=\"async\" width=\"564\" height=\"50\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Ping-version-output-in-Terminal.png\/public\" alt=\"Ping version output in Terminal\" class=\"wp-image-93441\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Ping-version-output-in-Terminal.png\/w=564,fit=scale-down 564w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Ping-version-output-in-Terminal.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Ping-version-output-in-Terminal.png\/w=150,fit=scale-down 150w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\" \/><\/a><\/figure><\/div><p>Depending on your machine&rsquo;s operating system, the installation steps may differ. For example, we will run this <a href=\"\/ng\/tutorials\/linux-commands\">Linux command<\/a> to install ping on our <strong>Ubuntu 22.04<\/strong> test system:<\/p><pre class=\"wp-block-preformatted\">sudo apt-get update &amp;&amp; install iputils-ping<\/pre><p>Once installed, run the ping command with the following syntax. It should be the same for all distributions:<\/p><pre class=\"wp-block-preformatted\">ping option destination<\/pre><p>Replace <strong>destination <\/strong>with the target system&rsquo;s exact IP address, hostname, or URL. You can also add an option to specify the command&rsquo;s behavior. Here are some of the most popular options:<\/p><figure tabindex=\"0\" class=\"wp-block-table is-style-regular\"><table><tbody><tr><td><strong>Options<\/strong><\/td><td><strong>Usage<\/strong><\/td><\/tr><tr><td><strong>-c<\/strong>                                                                            <\/td><td>sets how many packets to send<\/td><\/tr><tr><td><strong>-a<\/strong><\/td><td>plays a sound when the destination responds<\/td><\/tr><tr><td><strong>-i<\/strong><\/td><td>changes the interval to send packets<\/td><\/tr><tr><td><strong>-v<\/strong><\/td><td>enables verbose output<\/td><\/tr><tr><td><strong>-V<\/strong><\/td><td>checks the ping version<\/td><\/tr><tr><td><strong>-q<\/strong><\/td><td>summarizes all the ping results in one output<\/td><\/tr><tr><td><strong>-f<\/strong><\/td><td>floods the destination host with a large number of packets for stress tests<\/td><\/tr><tr><td><strong>-4 <\/strong>and <strong>-6<\/strong><\/td><td>specify the destination IP address protocol as IPv4 or IPv6, respectively<\/td><\/tr><tr><td><strong>-s<\/strong><\/td><td>modifies the maximum transmission unit<\/td><\/tr><tr><td><strong>-D<\/strong><\/td><td>starts each ping result with a UNIX timestamp<\/td><\/tr><tr><td><strong>-W <\/strong>or<strong> -w<\/strong><\/td><td>sets a timeout for each packet or session, respectively<\/td><\/tr><\/tbody><\/table><\/figure><p><div class=\"protip\">\n                    <h4 class=\"title\">Pro Tip<\/h4>\n                    <p> Combine multiple ping command options for more specific testing.<\/p>\n                <\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-how-to-use-the-linux-ping-command\">How to Use the Linux Ping Command<\/h2><p>This section will explore the Linux ping command&rsquo;s use cases, syntax, and output. To run these commands in a remote machine, connect using an <a href=\"\/ng\/tutorials\/how-to-use-putty-ssh\">SSH client like PuTTY<\/a> or Terminal. For Hostinger users, use the integrated <a href=\"https:\/\/support.hostinger.com\/en\/articles\/7978544-how-to-use-the-browser-terminal\">Browser Terminal<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-1-check-connectivity\">1. Check Connectivity<\/h3><p>The most basic ping command lets you check a server&rsquo;s internet connection. For example, run the following to check if your system is connected to the internet and can reach Google&rsquo;s host server:<\/p><pre class=\"wp-block-preformatted\">ping google.com<\/pre><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-for-google-domain.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1193\" height=\"197\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-for-google-domain.png\/public\" alt=\"The ping output for google domain\" class=\"wp-image-93442\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-for-google-domain.png\/w=1193,fit=scale-down 1193w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-for-google-domain.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-for-google-domain.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-for-google-domain.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-for-google-domain.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1193px) 100vw, 1193px\" \/><\/a><\/figure><\/div><p>Use this command to check whether your VPS is running and responding to the client&rsquo;s connection. Use its hostname or IP address as the destination:<\/p><pre class=\"wp-block-preformatted\">ping 185.185.185.185<\/pre><p>If Terminal returns the ICMP echo message response, your system is active and connected to the internet.<\/p><p>Otherwise, the VPS or the client machine may be encountering issues. To check whether your current system is experiencing a network connection problem, ping its hostname:<\/p><pre class=\"wp-block-preformatted\">ping localhost<\/pre><p>If the ping command returns an echo response, the problem lies on the remote system.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">Checking Hostinger VPS availability<\/h4>\n                    <p>Hostinger VPS users can check if their server is reachable by asking Kodee AI assistant, \"Check if any of my VPS is experiencing downtime, network issues, or disruptions.\"<\/p>\n                <\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-2-specify-the-echo-request-number\">2. Specify the ECHO_REQUEST Number<\/h3><p>By default, ping sends unlimited packets until the user terminates the process. To send a specific number of packets, use the<strong> -c<\/strong> option:<\/p><pre class=\"wp-block-preformatted\">ping -c * destination<\/pre><p>Replace <strong>* <\/strong>with the limit number for your packets. For example, this ping command will send five packets to the specified IP address:<\/p><pre class=\"wp-block-preformatted\">ping -c 5 185.185.185.185<\/pre><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-c-option.png\"><img loading=\"lazy\" decoding=\"async\" width=\"992\" height=\"241\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-c-option.png\/public\" alt=\"The ping output with the -c option\" class=\"wp-image-93452\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-c-option.png\/w=992,fit=scale-down 992w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-c-option.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-c-option.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-c-option.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 992px) 100vw, 992px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-3-audible-ping\">3. Audible Ping<\/h3><p>The <strong>-a<\/strong> option will play a sound when the ping command receives a response from the target device. Since keeping Terminal open until it receives a response is inconvenient, this option is useful for network troubleshooting.<\/p><p>The syntax and output are similar to the basic ping command:<\/p><pre class=\"wp-block-preformatted\">ping -a destination<\/pre><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-a-option-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"992\" height=\"241\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-a-option-1.png\/public\" alt=\"The ping output with the -a option\" class=\"wp-image-93457\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-a-option-1.png\/w=992,fit=scale-down 992w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-a-option-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-a-option-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-a-option-1.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 992px) 100vw, 992px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-4-set-intervals\">4. Set Intervals<\/h3><p>The ping command will send a packet every second. However, you may need to change it for a specific task. For instance, a shorter time interval is useful during troubleshooting since you will get more data samples.<\/p><p>To change the ping interval&rsquo;s default value, use the<strong> -i<\/strong> option and specify the number of seconds. To set it faster than a second, use a decimal. Here&rsquo;s an example:<\/p><pre class=\"wp-block-preformatted\">ping -i 0.5 185.185.185.185<\/pre><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-i-option-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"875\" height=\"251\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-i-option-1.png\/public\" alt=\"The ping output with the -i option\" class=\"wp-image-93446\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-i-option-1.png\/w=875,fit=scale-down 875w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-i-option-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-i-option-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-i-option-1.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 875px) 100vw, 875px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-5-receive-only-the-linux-ping-command-summary\">5. Receive Only the Linux Ping Command Summary<\/h3><p>Continuous ping monitoring can be tedious due to Terminal&rsquo;s long output. To simplify the results, use the <strong>-q <\/strong>option. The command will summarize all the ping statistics in a single output, simplifying analysis:<\/p><pre class=\"wp-block-preformatted\">ping -q destination<\/pre><p>If you don&rsquo;t specify the number of packets, the summary will appear after you terminate the process.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/q-pic.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1042\" height=\"134\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/q-pic.png\/public\" alt=\"The ping output with the -q option\" class=\"wp-image-93463\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/q-pic.png\/w=1042,fit=scale-down 1042w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/q-pic.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/q-pic.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/q-pic.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/q-pic.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1042px) 100vw, 1042px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-6-flood-the-network-with-the-linux-ping-command\">6. Flood the Network with the Linux Ping Command<\/h3><p>The ping command lets you rapidly send packets in large quantities using the <strong>-f <\/strong>option. It helps simulate your server performance during a traffic spike or <a href=\"https:\/\/support.hostinger.com\/en\/articles\/5634639-what-is-a-ddos-attack-and-how-to-prevent-it\">distributed denial-of-service<\/a> (DDoS) attack. Here&rsquo;s the command syntax:<\/p><pre class=\"wp-block-preformatted\">ping -f destination<\/pre><p>Like the<strong> -q <\/strong>option, the ping flood command will only show the summary of the packet responses. For example, the following output shows we sent over 200 ping packets in two seconds.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-f-option.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1069\" height=\"129\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-f-option.png\/public\" alt=\"The ping output with the -f option\" class=\"wp-image-93454\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-f-option.png\/w=1069,fit=scale-down 1069w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-f-option.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-f-option.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-f-option.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-f-option.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1069px) 100vw, 1069px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-7-specify-the-internet-protocol\">7. Specify the Internet Protocol<\/h3><p>Due to internet development, the IPv4 IP addresses are running out, and IPv6 is becoming more common. The ping command&rsquo;s default setting uses IPv4, but you can use either internet protocol.<\/p><p>Add the <strong>-4<\/strong> option to use the IPv4 address and <strong>-6<\/strong> to send an IPv6 ping. Here is how the ping commands look:<\/p><pre class=\"wp-block-preformatted\">ping -4 destination<\/pre><pre class=\"wp-block-preformatted\">ping -6 destination<\/pre><p>You can still ping a hostname or domain name with these options. In this case, the output will show that the destination is resolved to the corresponding IP address.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-4-option.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1160\" height=\"196\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-4-option.png\/public\" alt=\" The ping output with the -4 option\" class=\"wp-image-93455\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-4-option.png\/w=1160,fit=scale-down 1160w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-4-option.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-4-option.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-4-option.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-4-option.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1160px) 100vw, 1160px\" \/><\/a><\/figure><\/div><h3 class=\"wp-block-heading\" id=\"h-8-change-the-size-of-the-ping-packet\">8. Change the Size of the Ping Packet<\/h3><p>By default, the ping command sends a packet with <strong>56(84) bytes <\/strong>of data. <strong>56 <\/strong>represents your packet size in bytes. Meanwhile, <strong>84 <\/strong>specifies the total ping byte size, including all headers, which add <strong>28 bytes<\/strong>.<\/p><p>You can change the default size to check whether your network link throttles when receiving a larger packet. To do so, use the <strong>-s <\/strong>option:<\/p><pre class=\"wp-block-preformatted\">ping -s 1234 destination<\/pre><p>Replace <strong>1234<\/strong> with your actual ping packet size in <strong>bytes<\/strong>. Remember that the size in your command doesn&rsquo;t include the header. So, if you write <strong>1000<\/strong>, the total size of your packet will be <strong>1028 <\/strong>bytes.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-s-option-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"182\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-s-option-1.png\/public\" alt=\" The ping output with the -s option\" class=\"wp-image-93453\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-s-option-1.png\/w=785,fit=scale-down 785w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-s-option-1.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-s-option-1.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-s-option-1.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/a><\/figure><\/div><p><div><p class=\"important\"><strong>Important!<\/strong> Due to the protocol limitations, the maximum packet size is <strong>65,535 bytes<\/strong>, including the header.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-9-add-a-timestamp\">9. Add a Timestamp<\/h3><p>To simplify network performance monitoring, the ping command lets you add a timestamp to the packet response. To do so, add the<strong> -D<\/strong> option using the following command syntax:<\/p><pre class=\"wp-block-preformatted\">ping -D destination<\/pre><p>The output will begin with a timestamp in a UNIX format similar to the following:<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-D-option.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1177\" height=\"90\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-D-option.png\/public\" alt=\"The ping output with the -D option\" class=\"wp-image-93458\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-D-option.png\/w=1177,fit=scale-down 1177w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-D-option.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-D-option.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-D-option.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-output-with-the-D-option.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1177px) 100vw, 1177px\" \/><\/a><\/figure><\/div><p>The timestamp shows the second, minute, hour, day, month, and year of each response. To convert it into a human-readable format, use an online tool like <a href=\"http:\/\/epochconverter.com\">Epoch Converter<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"h-10-timeout-ping\">10. Timeout Ping<\/h3><p>The ping command has two timeout options, <strong>-W <\/strong>and <strong>-w<\/strong>. The <strong>-W<\/strong> option determines the time each ping will wait until the specified host sends a response. If it exceeds the time, the request is timed out.<\/p><p>Meanwhile, the &ndash;<strong>w<\/strong> option sets the time limit before the ping command exits. Terminal will automatically terminate the process once it reaches the specified time. Here are the syntaxes for the ping commands:<\/p><pre class=\"wp-block-preformatted\">ping -W * destination<\/pre><pre class=\"wp-block-preformatted\">ping -w * destination<\/pre><p>Replace <strong>*<\/strong> with the timeout duration in seconds. For example, use the following to ping your remote host for five seconds:<\/p><pre class=\"wp-block-preformatted\">ping -w 5 185.185.185.185<\/pre><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/w-5.png\"><img loading=\"lazy\" decoding=\"async\" width=\"897\" height=\"74\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/w-5.png\/public\" alt=\"The ping output with -w 5 options\" class=\"wp-image-93464\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/w-5.png\/w=897,fit=scale-down 897w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/w-5.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/w-5.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/w-5.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 897px) 100vw, 897px\" \/><\/a><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-interpreting-ping-results\">Interpreting Ping Results<\/h2><p>The ping response gives you various information about your network connectivity. The output may differ depending on your option and network condition, but the structure remains as follows:<\/p><pre class=\"wp-block-preformatted\">64 bytes from (185.185.185.185): icmp_seq=1 ttl=64 time=0.1 ms<\/pre><p>Here&rsquo;s how to interpret the above ping output:<\/p><ul class=\"wp-block-list\">\n<li><strong>64 bytes <\/strong>&ndash; the packet size in ICMP protocol data bytes. It adds<strong> 8<\/strong> bytes to your packet size for the ICMP header.<\/li>\n\n\n\n<li><strong>from (185.185.185.185): <\/strong>&ndash; the destination address that responds to your ping. If you use a hostname or domain, it will show the resolved IP address.<\/li>\n\n\n\n<li><strong>Icmp_seq <\/strong>&ndash; the packet&rsquo;s ICMP sequence number. The number will increase by a single digit for subsequent echo requests.<\/li>\n\n\n\n<li><strong>ttl (time to live)<\/strong> &ndash; this metric indicates how many times the packet can move between routers before it expires.<\/li>\n\n\n\n<li><strong>time=0.1 ms <\/strong>&ndash; the total round-trip time (RTT) for a packet, including the delay.<\/li>\n<\/ul><p>At the end of the output is the ping statistics line, which summarizes all the packets. These data are useful for latency and packet loss analysis. In other words, you can use it to identify potential issues that slow down your network.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-statistics-summary-line.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1193\" height=\"71\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-statistics-summary-line.png\/public\" alt=\"The ping statistics summary line\" class=\"wp-image-93465\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-statistics-summary-line.png\/w=1193,fit=scale-down 1193w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-statistics-summary-line.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-statistics-summary-line.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-statistics-summary-line.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/The-ping-statistics-summary-line.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1193px) 100vw, 1193px\" \/><\/a><\/figure><\/div><h2 class=\"wp-block-heading\" id=\"h-tips-for-effective-ping-command-usage\">Tips for Effective Ping Command Usage<\/h2><p>In this section, we will explore ping best practices to help you effectively use the tool for network diagnostics and monitoring.<\/p><p><strong>Use Ping to Diagnose Internal and External Network Issues<\/strong><\/p><p>If you have multiple systems in a network, determining where the problem lies can be difficult. The ping command lets you target different destinations to easily pinpoint which system is experiencing an issue.<\/p><p>Moreover, you can ping your current system to diagnose the local network interface. By looping packets, you can determine whether its networking stack is working properly.<\/p><p><strong>Compare Ping Results to Establish Baselines for Network Performance<\/strong><\/p><p>To identify network issues, you must understand how it typically performs. Keep in mind that every network behaves differently due to factors like load, topology, and distance.<\/p><p>Running the ping command multiple times lets you determine the performance benchmark for network baseline analysis.<\/p><p>If your ping result deviates from the baseline, it indicates potential issues. Moreover, you can use it to assess your server performance after implementing changes.<\/p><p><strong>Be Cautious of Firewall Settings That Might Block ICMP Requests<\/strong><\/p><p>Some Linux distributions&rsquo; firewalls may block ICMP requests by default, preventing you from receiving or sending ping packets.<\/p><p>To check for a firewall and ICMP requests conflict, list your <a href=\"\/ng\/tutorials\/iptables-tutorial\">iptables<\/a> rules using the following command:<\/p><pre class=\"wp-block-preformatted\">sudo iptables -L<\/pre><p>Look for a rule containing <strong>ICMP <\/strong>with the<strong> DROP<\/strong> or <strong>REJECT<\/strong> value. To allow ping requests, remove the rules from iptables using the following command syntax:<\/p><pre class=\"wp-block-preformatted\">sudo iptables -D rules<\/pre><p><strong>Use Ping in Combination With Other Diagnostic Tools for Comprehensive Analysis<\/strong><\/p><p>While suitable for basic analysis, the ping command may be insufficient for diagnosing all network issues. Try pairing it with other Linux networking tools for a more in-depth analysis.<\/p><p>For example, combine<strong> traceroute<\/strong> and ping to track a packet route from the client system to the destination. For testing network performance, use <strong>Iperf<\/strong> to measure the maximum connection speed and bandwidth.<\/p><p>Hostinger&rsquo;s <a href=\"\/ng\/vps-hosting\">VPS hosting services<\/a> can use <a href=\"\/ng\/support\/1583483-comprehensive-guide-to-hpanel-at-hostinger\/\"><strong>hPanel<\/strong><\/a>&rsquo;s <strong>Server Usage<\/strong> feature to easily monitor packet transmission and network usage with a user-friendly graph.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><a href=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2019\/03\/Packet-transmission-graph-in-Hostinger-VPS-Server-Usage-menu.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1383\" height=\"769\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Packet-transmission-graph-in-Hostinger-VPS-Server-Usage-menu.png\/public\" alt=\"Packet transmission graph in Hostinger VPS Server Usage menu\" class=\"wp-image-93466\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Packet-transmission-graph-in-Hostinger-VPS-Server-Usage-menu.png\/w=1383,fit=scale-down 1383w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Packet-transmission-graph-in-Hostinger-VPS-Server-Usage-menu.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Packet-transmission-graph-in-Hostinger-VPS-Server-Usage-menu.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Packet-transmission-graph-in-Hostinger-VPS-Server-Usage-menu.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2019\/03\/Packet-transmission-graph-in-Hostinger-VPS-Server-Usage-menu.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1383px) 100vw, 1383px\" \/><\/a><\/figure><\/div><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ng\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/public\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>The Linux<strong> <\/strong>ping command is a tool for testing connectivity and system availability. It is pre-installed in most Linux distributions and accessible via Terminal or an SSH client. It involves sending ICMP packets to a destination machine using its hostname, domain, or IP address.<\/p><p>Users can add various options to modify the command for different testing scenarios. For example, use <strong>-c<\/strong> to set the number of sent packets, <strong>-i <\/strong>to change the time interval, and <strong>-q<\/strong> to summarize the ping results in one output.<\/p><p>The ping output gives you information about the packet&rsquo;s destination, size, time to live, and response time. In addition to a remote system, you can ping your local computer to diagnose internal network problems.<\/p><p>Your system firewall may cause ping not to work properly. When pinging, ensure your system firewall doesn&rsquo;t block the ICMP packets.<\/p><p>For more accurate diagnostics, run the command multiple times and pair it with other tools like traceroute.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Linux ping command is a tool for diagnosing connectivity issues, monitoring network performance, and checking server availability. It is pre-installed in most distributions and accessible via Terminal or an SSH client. The ping command works by sending Internet Control Message Protocol (ICMP) packets to a specified address. If the target server returns an ICMP [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/linux-ping-command-with-examples\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":337,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Use the Linux Ping Command in %currentyear%","rank_math_description":"The Linux ping command is useful for diagnosing networks and troubleshooting. Check out this article to learn how to use it.","rank_math_focus_keyword":"linux ping command","footnotes":""},"categories":[22644],"tags":[],"class_list":["post-15883","post","type-post","status-publish","format-standard","hentry","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/linux-ping-command-with-examples","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/comando-ping-linux","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/commande-ping-linux","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/comando-ping-linux","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/linux-ping","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/linux-ping-command-with-examples","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/linux-ping-command-with-examples","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/linux-ping-command-with-examples","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/comando-ping-linux","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/comando-ping-linux","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/comando-ping-linux","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/comando-ping-linux","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/linux-ping-command-with-examples","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/linux-ping-command-with-examples","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/linux-ping-command-with-examples","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/linux-ping-command-with-examples","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=15883"}],"version-history":[{"count":21,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15883\/revisions"}],"predecessor-version":[{"id":145120,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/15883\/revisions\/145120"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=15883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=15883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=15883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}