← 返回命令列表

Linux command

inotify-wait 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Watch file for changes

inotifywait [file]

Monitor directory recursively

inotifywait -r [directory]

Watch for specific events

inotifywait -e [modify,create,delete] [path]

Monitor continuously

inotifywait -m [path]

Output in CSV format

inotifywait -m --csv [path]

Watch with timeout

inotifywait -t [30] [path]

说明

inotifywait waits for filesystem events using Linux's inotify interface. It exits when specified events occur on watched paths. The tool enables event-driven scripts that react to file changes. It supports monitoring files, directories, and recursive watching.

参数

-m, --monitor
Monitor continuously (don't exit after first event).
-r, --recursive
Watch directories recursively.
-e _EVENT_
Events to watch (access, modify, create, delete, move).
-t _SECONDS_
Timeout in seconds.
--csv
Output in CSV format.
--format _FMT_
Custom output format.
-q, --quiet
Suppress non-essential output.
--help
Display help information.

FAQ

What is the inotify-wait command used for?

inotifywait waits for filesystem events using Linux's inotify interface. It exits when specified events occur on watched paths. The tool enables event-driven scripts that react to file changes. It supports monitoring files, directories, and recursive watching.

How do I run a basic inotify-wait example?

Run `inotifywait [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -m, --monitor do in inotify-wait?

Monitor continuously (don't exit after first event).