In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "Linux basic command which use method". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
watch is a very useful command, basically all Linux distributions have this small tool, as the name, watch can help you monitor the results of a command, save you running it manually over and over again. Under Linux, watch is the periodic execution of the next program and displays the execution results in full screen. You can use it to monitor the results of all commands you want, such as tail a log file, ls to monitor the size of a file, depending on your imagination!
1. Command Format:
watch[argument][command]
2. Command function:
The output result of the command can be output to the standard output device, which is mostly used for periodic execution of commands/timed execution of commands.
3. Command Parameters:
-n or--interval watch By default, the program runs every 2 seconds. You can specify the interval with-n or-interval.
-d or--differences Use the-d or--differences option watch to highlight the changed areas. The-d=cumulative option highlights all changes (whether or not the most recent one was).
-t or-no-title will close the watch command at the top of the time interval, command, and output the current time.
-h, --help View help documentation
4. Examples of use:
Example 1: Highlight changes in the number of network links every second
Command:
watch -n 1 -d netstat -ant
Description:
Other operations:
Switch terminals: Ctrl+x
Exit watch: Ctrl+g
Example 2: Highlight http link count change every second
Command:
watch -n 1 -d 'pstree|grep http'
Description:
Highlight changes in http link count every second. If the following command has a pipe character, you need to add '' to organize the command area.
Example 3: Real-time view of the number of connections established by the mock attack client
Command:
watch 'netstat -an | grep:21 | \ grep client_ip| wc -l'
Example 4: Monitoring changes in scf'files in the current directory
Command:
watch -d 'ls -l|grep scf'
Example 5: Average load of a 10-second output system
Command:
watch -n 10 'cat /proc/loadavg'
"Linux basic command which use method" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!
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.