One linux command every day (48): watch Command

Source: Internet
Author: User
One linux command every day (48): watch command link: One linux command every day (47): iostat command http://www.2cto.com/os/201212/180543.html Watch is a very practical command. basically all Linux distributions have this tool, like name 1... one linux command every day (48): watch command link: One linux command every day (47): iostat command http://www.2cto.com/os/201212/180543.html Watch is a very practical command. basically all Linux distributions have this tool. like a name, watch can help you monitor the running results of a command, saving you the need to run it manually over and over again. In Linux, watch periodically runs the next program and displays the execution result in full screen mode. You can use it to monitor the result changes of all the commands you want, such as tail a log file, ls to monitor the size changes of a file, and check your imagination! 1. command format: www.2cto.com watch [parameter] [command] 2. command function: you can output the command output result to the standard output device. it is mostly used for periodical or scheduled command execution. command parameter:-n or -- interval watch runs the program every 2 seconds by default. you can use-n or-interval to specify the interval. -D or -- differences use-d or -- differences option watch to highlight the changed area. The "-d = cumulative" option will highlight the changed area (no matter whether there is a recent change. -T or-no-title will close the time interval at the top of the watch command, command, and current time output. -H, -- help to view help documentation 4. run the instance: instance 1: www.2cto.com command: the network link count changes are highlighted every second. watch-n 1-d netstat-ant description: other operations: switch terminal: ctrl + x exit watch: Ctrl + g instance 2: The number of http links is highlighted every second. Command: watch-n 1-d 'pstree | grep http' description: the number of http links is highlighted every second. If the following command carries a pipeline character, you need to add ''to normalize the command area. Instance 3: view the number of connections established by the simulated attack client in real time. Command: watch 'netstat-an | grep: 21 | \ grep <模拟攻击客户机的ip> | Wc-l 'description: instance 4: command used to monitor the change of the scf file in the current directory: watch-d 'ls-l | grep scf 'average load command of the output system once every 5: 10 seconds for the instance: watch-n 10'cat/proc/loadavg'
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.