In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use the Linux command inotify, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Linux commonly used commands Inotify is a powerful, fine-grained, asynchronous file system monitoring mechanism that meets a variety of file monitoring needs. It can monitor file system access properties, read-write properties, permission properties, delete creation, movement and other operations, that is, it can monitor all changes in files.
Insert the code chip here to install the inotify software first check your own system version (uname-r) my system is centos 7 [root@oa] # uname-r 3.10.0-1127.13.1.el7.x86_64 check whether the software [root@oa] # rpm-qa inotify-tools is installed, check if there is software in the warehouse [root@oa ~] # yum search inotify-tools if the software is in the warehouse Install the corresponding epel source [root@oa ~] # wget-O / etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo to clean the cache [root@oa ~] # yum clean all [root@oa ~] # yum makecache install the inotify-tools software [root@oa ~] # yum install inotify-tools-y 12345678910111213141516 as a simple example to test on this host. Monitor the addition, deletion, modification and query of files in the / home/awk directory. Open two ssh. One enters the monitoring command, and the other observes.
[root@oa ~] # inotifywait-mrq-e'create,delete,close_write,attrib,moved_to'-- timefmt'% Y-%m-%d% HRV% M'-- format'% T% w% f% e' / home/awk 1 do the following under the / home/awk directory of host 234 while you can observe the explanation of the monitoring screen command on another ssh page.
Inotifywait-mrq-e 'create,delete,close_write,attrib,moved_to'-- timefmt'% Y-%m-%d% H15% M'-- format'% T% w% f% e'/ home/awk 1 parameter:
Parameter description-m continuous monitoring-r uses recursive form to monitor the directory-Q to reduce redundant information, only print out the required information-e specifies the events to be monitored, multiple times are separated by commas-timefmt time format-changes in files monitored by format-timefmt description: Ymd indicates year, month and day, H indicates hours, M indicates minutes-format description:
Parameter description% w represents the directory where the event occurred,% f represents the file% e where the event occurred, the event% Xe event is separated by "X"% T using events that can be monitored by the time format defined by-timefmt:
Parameter description access access, read the file. Modify is modified, the file content is modified, the attrib property is modified, and the file metadata is modified. Move move, move the file. Create create, generate new files open open, open files close close, close files. The delete is deleted and the file is deleted. The above is all the contents of the article "how to use Linux commands inotify". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.