watch: merge common and linux, add examples (#15644)

Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
This commit is contained in:
Managor
2025-02-06 13:15:36 +01:00
committed by GitHub
co-authored by Lena
parent f8a87f0d68
commit 745d8aebd1
2 changed files with 13 additions and 25 deletions
+13 -5
View File
@@ -1,6 +1,6 @@
# watch
> Execute a program periodically, showing output fullscreen.
> 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:
@@ -9,12 +9,20 @@
- Re-run a command every 60 seconds:
`watch -n {{60}} {{command}}`
`watch --interval {{60}} {{command}}`
- Monitor the contents of a directory, highlighting differences as they appear:
- Monitor disk space, highlighting differences as they appear:
`watch -d {{ls -l}}`
`watch --differences {{df}}`
- Repeatedly run a pipeline and show the result:
`watch '{{command_1}} | {{command_2}} | {{command_3}}'`
`watch "{{command_1}} | {{command_2}} | {{command_3}}"`
- Exit `watch` if the visible output changes:
`watch --chgexit {{lsblk}}`
- Interpret terminal control characters:
`watch --color {{ls --color=always}}`
-20
View File
@@ -1,20 +0,0 @@
# watch
> Execute a command repeatedly, and monitor the output in full-screen mode.
> More information: <https://manned.org/watch>.
- Monitor files in the current directory:
`watch {{ls}}`
- Monitor disk space and highlight the changes:
`watch -d {{df}}`
- Monitor "node" processes, refreshing every 3 seconds:
`watch -n {{3}} "{{ps aux | grep node}}"`
- Monitor disk space and if it changes, stop monitoring:
`watch -g {{df}}`