ping / fping

What is ping?

ping is included in every linux distribution, but comes in many variants. Some of the most-used ping commands will be shown underneath

How to use ping

# syntax : 
ping <HOST/IP>

##### ping yourself by ip or name (127.0.0.1 is the same as localhost, which represents YOUR computer, local loopback)
ping 127.0.0.1 # ping yourself
ping localhost # ping yourself

##### ping with specific amount of packets
ping -c 1 127.0.0.1 # ping yourself, 1 packet
ping -c 4 127.0.0.1 # ping yourself, 4 packets

##### ping with specific amount of packets and size of the packets
ping -c 4 -s 50000 127.0.0.1 # ping yourself, 4 packets, packet size : 0.05mb in each packet
ping -c 4 -s 50000 -W 4 127.0.0.1 # ping yourself, 4 packets, packet size : 0.05mb in each packet, wait for a max of 4 seconds before you get a response

What is fping?

fping is a tool that is less populair, but it is still very usefull for pinging multiple hosts all at once. fping is a tool that can also be used to ping a single host, but in this section we will only talk about how to use it to ping multiple hosts at once

How to use fping

# Note : the part of the command "2> /dev/null" is used to suppress error messages.
# Otherwise, we will have a lot of unwanted messages interrupting us.

fping -g 192.168.0.0/24 2> /dev/null # notifies the user of all hosts that are up, but also of all the hosts that are down.
fping -ag 192.168.0.0/24 2> /dev/null # notifies the user of all hosts that are up, only the ip will come forward of the host that is up
fping -ag 192.168.0.0/24 -b 50000 2> /dev/null # notifies the user of all hosts that are up, only the ip will come forward of the host that is up, package size = 0.05mb

# tip :
# if you get the message : bash: /usr/bin/fping: No such file or directory
# use the command : apt install fping 

Last updated