Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the watch command in Linux

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to use the watch command in Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

The common Linux command watch can help you monitor the running results of a command to monitor the changes in the results of all the commands you want.

Common command parameters Usage: watch [- dhntv] [--differences [= cumulative]] [--help] [--interval=] [--no-title] [--version] command >-d,-- differences [= cumulative] highlight changes between updates (cumulative means highlighting is cumulative)-h,-- help print a summary of the options-n,-- interval= seconds to wait between updates-v -version print the version number-t,-- no-title turns off showing the header

Common command display

Highlight the change in the number of network links every other second

Watch-n 1-d netstat-ant [- n set interval,-d ls difference, highlight different] watch-d'ls / home/omd' [- d highlight] watch-t'ls / home/omd' [- t closes the time interval at the top of the watch command]

Description: Ctrl+c or Ctrl+z can exit the executing watch monitoring process

# highlight the changes in the number of http links every second watch-n 1-d'pstree | grep http'# view the number of connections established by a simulated attacking client in real time watch-n 1-d 'netstat-an | grep "21" | egrep "192.168.25.100" | wc-lumped # monitors the changes of scf' files in the current directory watch-d'ls-l | grep scf' # outputs the average load of the system watch-n 1-d "uptime" in 10 seconds

Watch can run multiple commands simultaneously, separated by semicolons.

The following command monitors the use of the disk and the changes in the files in the current directory, including the addition and deletion of files and the update of file modification dates.

Watch-d-n 1'df-h; ls-l'

This is the end of this article on "how to use watch commands in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report