inotifywait
Wait for changes to files. tldr-pages
On Linux
Linux
Watch a specific file for events, exiting after the first one
inotifywait path/to/fileIdentifyContinuously watch a specific file for events without exiting
inotifywait --monitor path/to/fileIdentifyWatch a directory recursively for events
inotifywait --monitor --recursive path/to/directoryIdentifyWatch a directory for changes, excluding files, whose names match a regex
inotifywait --monitor --recursive --exclude "regex" path/to/directoryIdentifyWatch a file for changes, exiting when no event occurs for 30 seconds
inotifywait --monitor --timeout 30 path/to/fileIdentifyOnly watch a file for file modification events
inotifywait --event modify path/to/fileIdentifyWatch a file printing only events, and no status messages
inotifywait --quiet path/to/fileIdentifyRun a command when a file is accessed
inotifywait --event access path/to/file && commandIdentify