Forrest logo
back to the watch tool

watch:tldr:2cc06

watch: Monitor disk space and if it changes, stop monitoring.
$ watch -g ${df}
try on your machine

The command "watch -g ${df}" is used to repeatedly execute the df command and display the output on the screen with highlighted differences. Here is a breakdown of this command:

  • "watch" is a command-line utility in Unix-like operating systems that can be used to run a command periodically and display the output on the terminal. It allows you to continuously monitor the output of a command without manually running it multiple times.

  • "-g" is an option specific to the watch command and it tells watch to highlight the differences between consecutive outputs of the command being executed. The differences will be displayed using special formatting, which makes it easier to identify changes.

  • "${df}" is the command that will be repeatedly executed by watch. In this case, "df" is a command used to display disk space usage statistics on Unix-like systems. By running this command with watch, the output of "df" will be displayed periodically, showing any changes in disk space usage.

Overall, running "watch -g ${df}" will continuously execute the "df" command, display the disk space usage statistics, and highlight any differences between consecutive outputs.

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