Forrest logo
back to the watch tool

watch:tldr:918d7

watch: Repeatedly run a pipeline and show the result.
$ watch '${command_1} | ${command_2} | ${command_3}'
try on your machine

The command "watch" is used in Unix-like operating systems to periodically execute another command and display its output on the terminal.

In this case, the command consists of a pipeline where three commands, command_1, command_2, and command_3 are executed in sequence with their output being passed to the next command using the pipe symbol (|).

The use of backticks (${}) indicates that the commands within them are variables, so instead of literally executing "${command_1} | ${command_2} | ${command_3}", the values of those variables will be substituted in.

So when the command is executed, it will periodically execute command_1, then pass its output as input to command_2, and finally pass the output of command_2 as input to command_3. The output of the whole pipeline will be displayed on the terminal. The frequency at which the commands are executed is determined by the watch command.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the watch tool