以下是一些Ubuntu下inotify的实用技巧:
sudo apt-get install inotify-tools安装。inotifywait -m /path/to/file_or_directory命令持续监控,-r选项可递归监控子目录,-e选项指定监控事件类型,如create、delete、modify等。-t选项设置超时时间,--format和--timefmt选项可自定义输出格式。-d选项将inotifywait作为守护进程运行,-o选项指定日志文件。/proc/sys/fs/inotify/下的相关文件,增加max_user_watches、max_user_instances等参数的值,以适应大规模监控需求。