以下是一些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等參數的值,以適應大規模監控需求。