Create a shell script that relates the speed of transfer of a HOP between the machine and the IP chosen. Use the PING command and express the result in kB/sec.
!/bin/bash
I create a temporary file
touch info.txt;
I take the second line of command PING stopped after two seconds I post the results in the file.
ping -t 2 $1 | head -2 | tail -1 > info.txt;
I take bytes
cut -c -2 info.txt;
I take ms
cut -c 53-59 info.txt;
Now, how to make transformations in KB and in Sec?
Show result
echo "Result: .....";
I delete the file.
rm file.txt;
You can do:
This is of course considering 1 KiB = 1024 bytes, where KiB is usually used for KB.