In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Command brief
The watch command executes a given command in a periodic manner and displays the execution results in full screen.
watch is a very useful command that is included in almost all Linux distributions. As the name suggests, watch helps monitor the results of a command, saving us from running it manually over and over again. For example, tail a log file, ls monitors the size change of a file, etc. The default is to run the program every 2 seconds. You can specify the interval with-n or--interval.
2. command format
watch [OPTIONS] COMMAND
3. option descriptions
-d, --differences [PERMANENT] Highlight differences between the last two updates. - The d cumulative option highlights all changes (regardless of the most recent)-n, --interval SECONDS Specifies the monitoring interval in seconds. default 2s, not less than 0.1s-p, --precise attempts to perform a command exactly at the specified interval Watch-t, --no-title close watch command time interval at top, command, output at current time-b, --beep monitored command exit code non-zero Beep-e, --errexit watch stops updating when monitored command error occurs and exits after key press-g, --chgexit exit watch-c when monitored command output changes, --color interprets ANSI color and style sequences-x, --exec passes commands to exec(2) instead of sh -c-h, --help displays help information and exits-v, --version displays version information and exits
4. Common examples
(1) Repeatedly execute the uptime command, which is executed every 2 seconds by default.
watch uptime
(2) Check the current directory file log changes.
watch -d "ls -l | grep log"
Note that when monitoring commands contain pipes, you need to enclose them in quotation marks.
(3) Check the average load of the system every 10s.
watch -n10 cat /proc/loadavg
(4) Highlight changes in the number of network connections every 1s.
watch -n1 -d netstat -ant
references
[1] watch(1) manual
The above is all the content of this article, I hope to help everyone's study, but also hope that everyone a lot of support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.