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)ping127.0.0.1# ping yourselfpinglocalhost# ping yourself##### ping with specific amount of packetsping-c1127.0.0.1# ping yourself, 1 packetping-c4127.0.0.1# ping yourself, 4 packets##### ping with specific amount of packets and size of the packetsping-c4-s50000127.0.0.1# ping yourself, 4 packets, packet size : 0.05mb in each packetping -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