How to Ping on Linux: 9 Steps

Table of contents:

How to Ping on Linux: 9 Steps
How to Ping on Linux: 9 Steps
Anonim

This article explains how to test the operation of an existing connection between a computer running Linux and another system using the "ping" command. You can also use a more advanced version of the "ping" command, called "traceroute", to view the set of IP addresses of all nodes on the network that data packets must traverse to reach the target computer.

Steps

Method 1 of 2: Using the Ping Command

Ping in Linux Step 2
Ping in Linux Step 2

Step 1. Open a "Terminal" window on your computer

Double-click on the "Terminal" app icon, characterized by the white "> _" symbols on a black background. Alternatively, press the key combination Ctrl + Alt + T.

Ping in Linux Step 3
Ping in Linux Step 3

Step 2. Type the ping command

Type ping into the "Terminal" window followed by the IP address or URL of the website you want to test.

For example, to ping the Facebook website, you would type the command ping www.facebook.com

Ping in Linux Step 4
Ping in Linux Step 4

Step 3. Press the Enter key

The "ping" command you created will be executed and the data packets will be sent to the specified address.

Ping in Linux Step 5
Ping in Linux Step 5

Step 4. Check the ping speed

On the right side of each line of text that appears you will find a number followed by "ms". This is the number of milliseconds it took data packets to reach the destination computer and come back.

  • The lower the number indicated, the higher the speed of the connection between your computer and the one being tested (or the website indicated).
  • When you ping a website via the "Terminal" app, the corresponding IP address is shown in the second line of text. You can use that address to ping instead of the URL.
Ping in Linux Step 6
Ping in Linux Step 6

Step 5. Stop executing the "ping" command

The "ping" command is executed indefinitely, so to terminate it, press the key combination Ctrl + C. The test results will appear on the screen below the "^ C" text line.

To find the average response time of the tested computer, look at the number after the first slash (/) in the line of text under the "# packets transmitted, # received" section

Method 2 of 2: Using the Traceroute Command

Ping in Linux Step 8
Ping in Linux Step 8

Step 1. Open a "Terminal" window on your computer

Double-click on the "Terminal" app icon, characterized by the white "> _" symbols on a black background. Alternatively, press the key combination Ctrl + Alt + T.

Ping in Linux Step 9
Ping in Linux Step 9

Step 2. Set the "traceroute" command

Type the keyword traceroute into the "Terminal" window followed by the IP address or URL of the website you want to track.

For example, if you want to know which path the data packets follow to reach the Facebook server, you will need to run the traceroute command www.facebook.com

Ping in Linux Step 10
Ping in Linux Step 10

Step 3. Press the Enter key

The indicated "traceroute" command will be executed.

Ping in Linux Step 11
Ping in Linux Step 11

Step 4. Analyze the data obtained from your request

On the left side of each new line of text that appears, there should be the IP address of the router that handled the transmission of the data packets sent from your computer. On the right side there is also the number of milliseconds required to pass through each network node.

  • If a line of text appears with only asterisks present, it means that the server that was to be contacted for data routing has not responded, so an alternate path will be used.
  • The execution of the "traceroute" command will be stopped as soon as the data packets reach their intended destination.

Recommended: