Ubuntu使用Ping

Ping command installation on Ubuntu 22.04

On Ubuntu 22.04 in order to install the Ping command, follow the below-given steps.

Step 1: Update system packages

First, press “CTRL+ALT+T” to open the terminal and update and upgrade the system packages:

1
$ sudo apt update && sudo apt upgrade

Step 2: Install Ping command

Use the command listed below to install the Ping command on your Ubuntu 22.04 system:

1
$ sudo apt install iputils-ping

Step 3: Ping verification

Verify the installation of the Ping command by checking the path where it is installed:

1
$ which ping

We have successfully installed Ping on the system, now move forward to check the method to use it.

How to use Ping command on Ubuntu 22.04

To use the Ping command on Ubuntu 22.04, go through the syntax and the demonstrated examples.

Syntax

Use the “ping” keyword along with the “options” and then mention the “hostname” or “IP”:

1
$ ping [options] [hostname/IP]

Some important options supported by the “ping” command are:

Options

Description

-c

To get the number of requests the user will perform.

-a

Create an alert and check the activation status of the host.

-i

Enable to set intervals.

-f

Allow users to send packets of 100 or more.

Examples

Let’s check out the whether the Ping command is working properly:

1
$ ping -c 1 itslinuxfoss.com

The given output indicates that we have successfully received a packet with the help of the Ping command:

Using “ping” along with “**-i 3”** the time interval is set to “300s” and “**-c 2” it will transmit and receive “2**” packets:

1
$ ping -i 3 -c 2 itslinuxfoss.com

Now, let’s check out how to remove the Ping command from Ubuntu 22.04.

How to remove Ping command from Ubuntu 22.04

To remove Ping from Ubuntu 22.04, process the following command:

1
$ sudo apt remove iputils-ping

We have completely described the ways to install, use, and remove the Ping command on Ubuntu 22.04.

Conclusion

Ping command is used to send “ICMP ECHO_REQUEST” packets over the network host. On Ubuntu 22.04, install the Ping command by executing “**$ sudo apt install iputils-ping” on Ubuntu’s terminal. You can also verify the Ping command installation using “$ which ping**” and use it along with different options. In this post, we have effectively explained the way to installuse, and remove the Ping command on Ubuntu 22.04.