inotifywait
monitoringLinux
The inotifywait command is one of the most frequently used commands in Linux/Unix-like operating systems. inotifywait Wait for changes to files using inotify
Quick Reference
Command Name:
inotifywait
Category:
monitoring
Platform:
Linux
Basic Usage:
inotifywait [options] [arguments]
Common Use Cases
Syntax
inotifywait [options] [file/directory...]
Options
Option | Description |
---|---|
-m, --monitor |
Keep monitoring indefinitely, rather than exiting after first event |
-r, --recursive |
Watch directories recursively |
-e, --event EVENT |
Watch for specific event(s) only (access, modify, attrib, close_write, close_nowrite, close, open, moved_to, moved_from, move, move_self, create, delete, delete_self, unmount) |
--exclude PATTERN |
Exclude files matching this regular expression |
--excludei PATTERN |
Like --exclude but case insensitive |
--include PATTERN |
Include only files matching this regular expression |
--includei PATTERN |
Like --include but case insensitive |
-q, --quiet |
Print less (only print events) |
-t, --timeout SECONDS |
Exit if no event occurs in SECONDS seconds |
--format FORMAT |
Print using a specified format string (%w=path, %f=file, %e=event, %T=date/time) |
--timefmt FORMAT |
Date/time format for use with %T in --format string |
-c, --csv |
Output in CSV format |
-s, --syslog |
Send errors to syslog rather than stderr |
-h, --help |
Show help message |
-v, --verbose |
Be verbose |
--version |
Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the inotifywait
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
inotifywait /path/to/file