{"id":1445,"date":"2020-11-11T17:24:02","date_gmt":"2020-11-11T17:24:02","guid":{"rendered":"https:\/\/linuxways.net\/?p=1445"},"modified":"2020-11-13T21:38:58","modified_gmt":"2020-11-13T21:38:58","slug":"how-to-use-ping-command-in-linux-mint-20","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/mint\/how-to-use-ping-command-in-linux-mint-20\/","title":{"rendered":"How to use Ping command in Linux"},"content":{"rendered":"<h2>Introduction:<\/h2>\n<p>The ping command in Linux is used to serve multiple purposes. These uses include checking if a host is reachable, verifying if a server is up and running, checking your Internet connection, and also to check any potential delays in the network. Apart from the basic usage of the ping command in Linux, there are several flags and options with which the Ping command can be used to serve multiple purposes.<\/p>\n<p><strong>In this article, we will be discussing multiple examples of using the Ping command in Linux Mint 20. However, the same commands should work on Debian 10 and Ubuntu 20.04<\/strong><\/p>\n<h2>Examples of Using the PING Command in Linux Mint 20:<\/h2>\n<p>Before getting started with the examples of the ping command in Linux Mint 20, we would like to walk you through its help manual in the following manner:<\/p>\n<pre><strong>ping --help<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"338\" height=\"33\" class=\"wp-image-1446\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-249.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-249.png 338w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-249-300x29.png 300w\" sizes=\"auto, (max-width: 338px) 100vw, 338px\" \/><\/strong><\/p>\n<p>Running this command will not only display the syntax of the ping command but will also enlist all the different options and flags with which this command can be used as shown in the image below. You can scroll down this list to see all the flags and options.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"654\" height=\"409\" class=\"wp-image-1447\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-250.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-250.png 654w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-250-300x188.png 300w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/p>\n<p>Now by using the help manual of the ping command, we have created a few examples of its usage as follows:<\/p>\n<h3>Example # 1: Simply Trying to Reach a Host:<\/h3>\n<p>The simplest use of the ping command is to try to reach a host by specifying its URL after the Ping command as shown below:<\/p>\n<pre><strong>ping google.com<\/strong><\/pre>\n<p>Here, you can replace google.com with any other host of your choice.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"369\" height=\"28\" class=\"wp-image-1448\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-251.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-251.png 369w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-251-300x23.png 300w\" sizes=\"auto, (max-width: 369px) 100vw, 369px\" \/><\/p>\n<p>When this command will be executed, the Ping requests will be sent after every second to the specified host as shown in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"412\" class=\"wp-image-1449\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-252.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-252.png 645w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-252-300x192.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/p>\n<p>At any point in time, if you feel like stopping this process, you can do it by pressing \u201cCtrl+ C\u201d. When the Ping process will terminal, you will be able to see its summary which will include things like the number of packets sent, round trip time (RTT), etc. as shown in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"654\" height=\"412\" class=\"wp-image-1450\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-253.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-253.png 654w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-253-300x189.png 300w\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" \/><\/p>\n<h3>Example # 2: Producing a Sound while Pinging a Host:<\/h3>\n<p>You can also cause a sound to be produced whenever you ping the desired host. This can be done in the manner shown below:<\/p>\n<pre><strong>ping \u2013a google.com<\/strong><\/pre>\n<p>Here, the &#8220;-a&#8221; flag is used to produce an audio\/ beep\/ sound along with each ping output whereas visually, that output will appear to be the same as Example # 1.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"397\" height=\"28\" class=\"wp-image-1451\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-254.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-254.png 397w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-254-300x21.png 300w\" sizes=\"auto, (max-width: 397px) 100vw, 397px\" \/><\/p>\n<h3>Example # 3: Checking the Local Network:<\/h3>\n<p>You can also check your local network with the help of the ping command in the following manner:<\/p>\n<pre><strong>ping localhost<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"362\" height=\"25\" class=\"wp-image-1452\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-255.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-255.png 362w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-255-300x21.png 300w\" sizes=\"auto, (max-width: 362px) 100vw, 362px\" \/><\/strong><\/p>\n<p>By running this command, you will be able to find out the IP address of your localhost as highlighted in the image shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"581\" height=\"345\" class=\"wp-image-1453\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-256.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-256.png 581w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-256-300x178.png 300w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/p>\n<h3>Example # 4: Setting a Specific Time Interval between Ping Packets:<\/h3>\n<p>As we have mentioned in Example # 1, the default time interval between two ping packets is 1 second. However, we can always change this time interval as per our requirements by running the Ping command in the following manner:<\/p>\n<pre><strong>ping \u2013i 2 google.com<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"410\" height=\"25\" class=\"wp-image-1454\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-257.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-257.png 410w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-257-300x18.png 300w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/strong><\/p>\n<p>Here, you can replace \u201c2\u201d with any time (in seconds) of your choice that you want to keep between two ping packets. In our case, a ping packet will be sent 2 seconds after the previous one. The output of this command is shown in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"648\" height=\"229\" class=\"wp-image-1455\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-258.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-258.png 648w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-258-300x106.png 300w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/p>\n<h3>Example # 5: Flooding a Host with Ping Requests:<\/h3>\n<p>You can also flood the desired host with ping requests in the following manner:<\/p>\n<pre><strong>sudo ping \u2013f google.com<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"435\" height=\"30\" class=\"wp-image-1456\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-259.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-259.png 435w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-259-300x21.png 300w\" sizes=\"auto, (max-width: 435px) 100vw, 435px\" \/><\/strong><\/p>\n<p>For flooding a host with ping requests, you will require root user privileges. However, as soon as you want this process to terminate, you can do this by pressing \u201cCtrl+ C\u201d after which the output shown in the image below will be displayed on your terminal:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"643\" height=\"170\" class=\"wp-image-1457\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-260.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-260.png 643w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-260-300x79.png 300w\" sizes=\"auto, (max-width: 643px) 100vw, 643px\" \/><\/p>\n<h3>Example # 6: Changing the Size of the Ping Packet:<\/h3>\n<p>The default size of a ping packet is 56 bytes. You can choose to increase or decrease this size according to your requirements in the following manner:<\/p>\n<pre><strong>ping \u2013s 100 google.com<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"423\" height=\"26\" class=\"wp-image-1458\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-261.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-261.png 423w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-261-300x18.png 300w\" sizes=\"auto, (max-width: 423px) 100vw, 423px\" \/><\/strong><\/p>\n<p>Here, you can replace \u201c100\u201d with any size (in bytes) of your choice that you want for your ping packet. Our newly sent ping packets will now have the size of 100 bytes after running this command and this can be verified from the size highlighted in the image shown below. Also, the number that is written between parentheses depicts the total size which also includes the 28 bytes of the header.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"554\" height=\"133\" class=\"wp-image-1459\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-262.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-262.png 554w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-262-300x72.png 300w\" sizes=\"auto, (max-width: 554px) 100vw, 554px\" \/><\/p>\n<h3>Example # 7: Limiting the Number of Ping Packets:<\/h3>\n<p>As you can see from the examples above that the Ping command starts sending infinite packets to the specified host and you need to forcefully stop this process. However, you can also limit the number of ping packets that you want to send by running the command stated below:<\/p>\n<pre><strong>ping \u2013c 3 google.com<\/strong><\/pre>\n<p>Here, you can replace \u201c3\u201d with whatever number of ping packets you wish to send. After sending the specified number of the ping packets, this command will terminate automatically.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"28\" class=\"wp-image-1460\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-263.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-263.png 411w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-263-300x20.png 300w\" sizes=\"auto, (max-width: 411px) 100vw, 411px\" \/><\/p>\n<p>From the output of this command, you can easily verify that only three ping packets were sent in this case as shown in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"230\" class=\"wp-image-1461\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-264.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-264.png 645w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-264-300x107.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/p>\n<h3>Example # 8: Setting a Time till you want to send the Ping Packets:<\/h3>\n<p>Instead of limiting the number of ping packets, you can also specify a time interval till which you wish to keep sending the ping packets in the manner shown below:<\/p>\n<pre><strong>ping \u2013w 10 google.com<\/strong><\/pre>\n<p>Here, you can replace \u201c10\u201d with the time interval (time in seconds) till which you wish to keep sending the ping packets to the specified host. Once that time will expire, this process will terminate automatically.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"415\" height=\"26\" class=\"wp-image-1462\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-265.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-265.png 415w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-265-300x19.png 300w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><\/p>\n<p>In our example, the Ping command stopped executing after 10 seconds as highlighted in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"410\" class=\"wp-image-1463\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-266.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-266.png 645w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-266-300x191.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/p>\n<h3>Example # 9: Getting only the Ping Statistics:<\/h3>\n<p>Instead of seeing the output of every single ping packet, you can also choose to view the summary of the whole process by running the Ping command in the manner shown below:<\/p>\n<pre><strong>ping \u2013c 5 \u2013q google.com<\/strong><\/pre>\n<p>Here, we have intentionally used the \u201c-c\u201d flag so that we can specify the number of ping packets whose summary we want to get. The \u201c-q\u201d flag will serve the purpose of displaying the summary.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"430\" height=\"24\" class=\"wp-image-1464\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-267.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-267.png 430w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-267-300x17.png 300w\" sizes=\"auto, (max-width: 430px) 100vw, 430px\" \/><\/p>\n<p>In our example, the summary of the five ping packets that were sent is shown in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"513\" height=\"124\" class=\"wp-image-1465\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-268.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-268.png 513w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-268-300x73.png 300w\" sizes=\"auto, (max-width: 513px) 100vw, 513px\" \/><\/p>\n<h3>Example # 10: Displaying the IP Addresses in the Ping Output:<\/h3>\n<p>If you wish to display the IP address of the location from where the ping packets were sent instead of the hostnames, you can use the Ping command in the manner shown below:<\/p>\n<pre><strong>ping \u2013n google.com<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"395\" height=\"28\" class=\"wp-image-1466\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-269.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-269.png 395w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-269-300x21.png 300w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\" \/><\/strong><\/p>\n<p>The IP address of the entity sending the ping packets is highlighted in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"571\" height=\"261\" class=\"wp-image-1467\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-270.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-270.png 571w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-270-300x137.png 300w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/><\/p>\n<h3>Example # 11: Displaying the Timestamps with the Ping Output:<\/h3>\n<p>If you also want to know the exact time according to your system&#8217;s clock at which a particular ping packet was sent, then you need to run the command stated below:<\/p>\n<pre><strong>ping \u2013D google.com<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"390\" height=\"21\" class=\"wp-image-1468\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-271.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-271.png 390w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-271-300x16.png 300w\" sizes=\"auto, (max-width: 390px) 100vw, 390px\" \/><\/strong><\/p>\n<p>The timestamps of each packet are shown before the other details related to every packet as highlighted in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"362\" class=\"wp-image-1469\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-272.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-272.png 647w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-272-300x168.png 300w\" sizes=\"auto, (max-width: 647px) 100vw, 647px\" \/><\/p>\n<h3>Example # 12: Asking for a Specific Internet Protocol with Ping:<\/h3>\n<p>With the Ping command, you can also specify the Internet protocol for receiving either IPv4 or IPv6 addresses in the manner shown below:<\/p>\n<pre><strong>ping -4 google.com<\/strong><\/pre>\n<p>Here, you can replace \u201c-4\u201d with \u201c-6\u201d if you wish to see the IPv6 addresses.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"395\" height=\"24\" class=\"wp-image-1470\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-273.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-273.png 395w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-273-300x18.png 300w\" sizes=\"auto, (max-width: 395px) 100vw, 395px\" \/><\/p>\n<p>The output of this command is shown in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"264\" class=\"wp-image-1471\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-274.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-274.png 645w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-274-300x123.png 300w\" sizes=\"auto, (max-width: 645px) 100vw, 645px\" \/><\/p>\n<h2>Conclusion:<\/h2>\n<p>In this article, we have shared with you multiple examples that demonstrate the usage of the ping command in Linux Mint 20. You can also combine two or more flags to serve a different purpose of your choice. However, all the basic uses of the Ping command have been shared with you in this article. You can follow this tutorial to use the Ping command very efficiently.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction: The ping command in Linux is used to serve multiple purposes. These uses include checking if a host is reachable, verifying if a server is up and&hellip;<\/p>","protected":false},"author":3,"featured_media":1584,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[45,15],"class_list":["post-1445","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mint","tag-linux-mint","tag-ping"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/1445","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=1445"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/1445\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/1584"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=1445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=1445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=1445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}