From 745d8aebd115297530ae46a9ad6ca7f2297ec5c6 Mon Sep 17 00:00:00 2001 From: Managor <42655600+Managor@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:15:36 +0200 Subject: [PATCH] watch: merge common and linux, add examples (#15644) Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com> --- pages/common/watch.md | 18 +++++++++++++----- pages/linux/watch.md | 20 -------------------- 2 files changed, 13 insertions(+), 25 deletions(-) delete mode 100644 pages/linux/watch.md diff --git a/pages/common/watch.md b/pages/common/watch.md index 0aad04cb1e..803af70cc5 100644 --- a/pages/common/watch.md +++ b/pages/common/watch.md @@ -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: . - 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}}` diff --git a/pages/linux/watch.md b/pages/linux/watch.md deleted file mode 100644 index 63e767157d..0000000000 --- a/pages/linux/watch.md +++ /dev/null @@ -1,20 +0,0 @@ -# watch - -> Execute a command repeatedly, and monitor the output in full-screen mode. -> More information: . - -- 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}}`