首页 > 代码库 > inotify之inotifywait命令常用参数详解

inotify之inotifywait命令常用参数详解

[root@inotify-master inotify-tools-3.14]# cd /usr/local/inotify-3.14/

[root@inotify-master inotify-3.14]# ./bin/inotifywait --help

-r|--recursive   Watch directories recursively. #递归查询目录

-q|--quiet      Print less (only print events). #打印监控事件的信息

-m|--monitor   Keep listening for events forever.  Without this option, inotifywait will exit after one  event is received.        #始终保持事件监听状态

--excludei <pattern>  Like --exclude but case insensitive.    #排除文件或目录时,不区分大小写。

--timefmt <fmt> strftime-compatible format string for use with %T in --format string. #指定时间输出的格式

--format <fmt>  Print using a specified printf-like format string; read the man page for more details.

#打印使用指定的输出类似格式字符串

-e|--event <event1> [ -e|--event <event2> ... ] Listen for specific event(s).  If omitted, all events are  listened for.   #通过此参数可以指定需要监控的事件,如下所示:

Events:

access           file or directory contents were read       #文件或目录被读取。

modify           file or directory contents were written    #文件或目录内容被修改。

attrib            file or directory attributes changed      #文件或目录属性被改变。

close            file or directory closed, regardless of read/write mode    #文件或目录封闭,无论读/写模式。

open            file or directory opened                    #文件或目录被打开。

moved_to        file or directory moved to watched directory    #文件或目录被移动至另外一个目录。

move            file or directory moved to or from watched directory    #文件或目录被移动另一个目录或从另一个目录移动至当前目录。

create           file or directory created within watched directory     #文件或目录被创建在当前目录

delete           file or directory deleted within watched directory     #文件或目录被删除

unmount         file system containing file or directory unmounted  #文件系统被卸载

inotify之inotifywait命令常用参数详解