![Forrest logo](/images/logo.png)
ttyplot:tldr:c258b
This command performs a series of operations using the utilities ping
, sed
, and ttyplot
in order to display and plot the results of a ping test to the 8.8.8.8 IP address.
Let's dissect the command step by step:
-
ping ${8-8-8-8}
: This initiates a ping test to the IP address 8.8.8.8. The${8-8-8-8}
is a way to add this IP address as an argument to theping
command. -
|
: This symbol is a pipe, used to pass the output of one command as input to the next command. -
sed -u '${s-^-*time=--g; s- ms--g}'
: Thesed
command is used here to modify the output of theping
command.-u
specifies that sed should output each line immediately, instead of buffering it. The following expression${s-^-*time=--g; s- ms--g}
is a sed script that performs two substitutions on each line:s-^-*time=--g
replaces the leading*
character (which is used to indicate packet loss) withtime=
. This helps in retrieving the ping time value for plotting.s- ms--g
removes thems
substring, which is the unit of the ping time.
-
|
: Another pipe symbol, passing the output of the previoussed
command to the next command. -
ttyplot -t "${ping to 8-8-8-8}" -u ${ms}
: This command usesttyplot
to plot the ping times received from the previous commands. The-t "${ping to 8-8-8-8}"
option sets the plot's title as "ping to 8.8.8.8", and-u ${ms}
sets the y-axis unit as milliseconds.
In summary, this command performs a ping test to 8.8.8.8, modifies the output to retrieve the ping times, and then plots those times using ttyplot
with the specified title and unit.