How to use the Linux Ping command

Linux’s PING, or Packet Internet Groper, command is a much-loved tool among . Its main purpose is to manage the state of network connectivity between a source and a device, with the help of an IP network. In this Linux Ping tutorial, you’ll learn how it can help your project and how to get started with it.

What is the Linux Ping command?

With the ping command, you can also find out how long it takes to send and receive responses from a network. It works by sending a series of Internet Control Message Protocol (ICMP) messages to the destination host and waiting for an ICMP echo message to and from the host and the Device. This will give you information about the running time of the network.

Basically, by using the command you will be sending the ECHO_REQUEST message and expecting the ECHO_RESPONSE. If the response message shows “fast ping low latency” then the connection is fast. It is measured in milliseconds.

Nowadays, all modern computers, or devices, have PING pre-installed, due to its many uses. This is a quick and direct way to verify performance between the device and the host.

Whether it’s a local area network (LAN) or a local area network (WAN), the ping command provides precise details about connectivity. It also allows you to get statistical summaries of the test, including the minimum and maximum rounds, the number of packets transmitted and received, the percentage of packets lost, and the standard deviation of the mean. It also allows the user to check the quality of the network connection between two devices. Sounds pretty good so far, right?

See also  Magento vs PrestaShop: Choosing the best platform for your online store

The Ping test between your computer and the destination host will allow you to determine:

  • Destination host state: if it is reachable.
  • Measurement of the time it takes for a message to go back and forth (Host-Computer-Host)
  • Percentage of packets lost.

How to install the Ping command on Linux

Remember, you will first need to access your VPS using SSH. You can check our if you have problems with this!

Most versions of Linux have the ping tool installed by default. You can check if it is, by running the following command:

ping -V

If ping is not installed on Linux, a quick system update should resolve the issue:

apt-get update && apt-get install -y iputils-ping

How to use the Linux Ping command?

There are several options in Linux that allow the user to test connectivity between two networks:

1. Checking connectivity

You can run a quick and simple command on your system to check the status of the host and that of the target server or computer.

As an example, we can check network connectivity with www.google.com:

ping google.com

If you’re not sure what the domain is, you can also use the IP address. Running the example will display Google’s IP address in parentheses, along with a full statistical summary.

  • min – refers to the minimum time expected to receive a response.
  • average – shows the expected average time to get responses.
  • max – reflects the maximum expected time to get a response.

To stop the ping command on Linux, you must type Ctrl+C, this will stop sending packets to the destination host. The command will stop all processes in the terminal.

See also  What is the WordPress sidebar or sidebar?

2. Specifying the ECHO_REQUEST number

command option -c is used to specify the number of packets or requests the user wants to make.

The syntax would be the following:

ping –c *exampledomain.com

Here * is the number of pings you want to perform.

3. With audible ping

command option -a of the Linux ping command beeps to verify if the host is up or not, informing you audibly.

The command would look like this:

ping –a exampledomain.com

Remember, to end the ping process, press Ctrl+C.

4. Setting intervals

The option -Yo allows the user to set intervals in seconds between each packet.

The command follows the same structure as the previous ones:

ping –i 2 –c 7 exampledomain.com

Numbers 2 and 7 can be changed for as long as you want.

5. Receiving only the Linux Ping command summary

To receive only the network summary, use the option –q in the Linux terminal command line:

ping –c 7 –q exampledomain.com

To recap once again, we are using -c 7 to make seven requests, but we only received the summary because it was added -q.

6. Flooding the network with the Ping command

The ping command allows users to send 100 or more packets per second, with the help of the following command:

ping –f exampledomain.com

This option is great if you want to test how your website or server handles network stress, i.e. a large number of requests.

Summary

On Linux, Ping is a commonly used tool for troubleshooting the reachability of hosts on a network. It helps us understand why a website might not be loading.

See also  How to Add Custom CSS to WordPress

Beyond this, you need to know the root cause of the problem. It could be anything from internet connectivity, loss of network, or website no longer available. Ping is the command that helps us determine the accessibility of a network device.

Being quick and direct, many users are choosing to use the ping command for troubleshooting. And, with this tutorial, we hope that now you can use it too!

Deyi is a digital marketing enthusiast, with a background in web design, content creation, copywriting, and SEO. She is part of ‘s SEO & Localization team. In her free time, she likes to develop projects, read a book or watch a good movie.

Loading Facebook Comments ...
Loading Disqus Comments ...