watch
Watch is a command line tool found in Unix-like operating systems. It allows users to execute a command repeatedly at regular intervals and display the output in real-time. The intervals can be specified using various time units such as seconds or milliseconds. One common use of the watch command is to monitor the changes in a file or directory by running a file listing command like ls. By default, watch runs indefinitely until interrupted by the user. However, it is possible to set a specific duration for the command to run. Watch allows users to customize the display by highlighting differences in output or by displaying the output in full color. It also has options to clear the screen before each run, to show the elapsed time, or to beep when a command has finished running. Watch is a powerful utility that enables users to monitor changes and updates in real-time, making it an essential tool for sysadmins and developers.
List of commands for watch:
-
watch:tldr:2cc06 watch: Monitor disk space and if it changes, stop monitoring.$ watch -g ${df}try on your machineexplain this command
-
watch:tldr:34ee2 watch: Repeatedly run a command and show the result.$ watch ${command}try on your machineexplain this command
-
watch:tldr:918d7 watch: Repeatedly run a pipeline and show the result.$ watch '${command_1} | ${command_2} | ${command_3}'try on your machineexplain this command
-
watch:tldr:b60e4 watch: Monitor the contents of a directory, highlighting differences as they appear.$ watch -d ${ls -l}try on your machineexplain this command
-
watch:tldr:e6c11 watch: Re-run a command every 60 seconds.$ watch -n ${60} ${command}try on your machineexplain this command