{"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-10T09:30:44","modified_gmt":"2026-03-10T09:30:44","slug":"linux-ping-command-with-examples","status":"publish","type":"post","link":"\/ca\/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\" target=\"_blank\" rel=\"noopener\"><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\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-69262\"  sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure>\n<\/div><p>\n\n\n<div class=\"protip\"><div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                   What Is the Ping Command in Linux?\n                <\/p>\n            <\/div>\n            <p class=\"protip__content\"><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><\/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=\"\/ca\/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\"  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=\"\/ca\/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            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Pro Tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\"> Combine multiple ping command options for more specific testing.<\/p>\n                    <\/div>\n        \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=\"\/ca\/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\" target=\"_blank\" rel=\"noopener\">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=\"\/ca\/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\/w=1024,h=1024,fit=scale-down\" alt=\"The ping output for google domain\" class=\"wp-image-93442\"  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            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Checking Hostinger VPS availability                <\/p>\n            <\/div>\n            <p class=\"protip__content\">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\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=\"\/ca\/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\"  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=\"\/ca\/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\"  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=\"\/ca\/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\"  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=\"\/ca\/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\/w=1024,h=1024,fit=scale-down\" alt=\"The ping output with the -q option\" class=\"wp-image-93463\"  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\" target=\"_blank\" rel=\"noopener\">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=\"\/ca\/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\/w=1024,h=1024,fit=scale-down\" alt=\"The ping output with the -f option\" class=\"wp-image-93454\"  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=\"\/ca\/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\/w=1024,h=1024,fit=scale-down\" alt=\" The ping output with the -4 option\" class=\"wp-image-93455\"  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=\"\/ca\/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\"  sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/a><\/figure><\/div><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> Due to the protocol limitations, the maximum packet size is <strong>65,535 bytes<\/strong>, including the header.\n            <\/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=\"\/ca\/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\/w=1024,h=1024,fit=scale-down\" alt=\"The ping output with the -D option\" class=\"wp-image-93458\"  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\" target=\"_blank\" rel=\"noopener\">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=\"\/ca\/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\"  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=\"\/ca\/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\/w=1024,h=1024,fit=scale-down\" alt=\"The ping statistics summary line\" class=\"wp-image-93465\"  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=\"\/ca\/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=\"\/ca\/vps-hosting\">VPS hosting services<\/a> can use <a href=\"\/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=\"\/ca\/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\/w=1024,h=1024,fit=scale-down\" alt=\"Packet transmission graph in Hostinger VPS Server Usage menu\" class=\"wp-image-93466\"  sizes=\"auto, (max-width: 1383px) 100vw, 1383px\" \/><\/a><\/figure><\/div><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-vps-hosting\" href=\"\/ca\/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\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-77934\"  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=\"\/ca\/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":[22699],"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-GB","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\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/users\/337"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/comments?post=15883"}],"version-history":[{"count":21,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15883\/revisions"}],"predecessor-version":[{"id":141496,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/posts\/15883\/revisions\/141496"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/media?parent=15883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/categories?post=15883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ca\/tutorials\/wp-json\/wp\/v2\/tags?post=15883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}