HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

watch — Execute a program periodically and monitor the output in full-screen mode. More information: <https:

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandperiodicallymonitorandexecutecliwatchprogram

Problem

How to use the watch command: Execute a program periodically and monitor the output in full-screen mode. More information: <https://manned.org/watch>.

Solution

watch — Execute a program periodically and monitor the output in full-screen mode. More information: <https://manned.org/watch>.

Repeatedly run a command and show the result:
watch {{command}}


Re-run a command every 60 seconds:
watch {{[-n|--interval]}} 60 {{command}}


Monitor disk space, highlighting differences as they appear:
watch {{[-d|--differences]}} df


Repeatedly run a pipeline and show the result:
watch "{{command1}} | {{command2}} | {{command3}}"


Exit watch if the visible output changes:
watch {{[-g|--chgexit]}} {{lsblk}}


Interpret terminal control characters:
watch {{[-c|--color]}} {{ls --color=always}}

Code Snippets

Repeatedly run a command and show the result

watch {{command}}

Re-run a command every 60 seconds

watch {{[-n|--interval]}} 60 {{command}}

Monitor disk space, highlighting differences as they appear

watch {{[-d|--differences]}} df

Repeatedly run a pipeline and show the result

watch "{{command1}} | {{command2}} | {{command3}}"

Exit `watch` if the visible output changes

watch {{[-g|--chgexit]}} {{lsblk}}

Context

tldr-pages: common/watch

Revisions (0)

No revisions yet.