fswatch
cross-platform file change monitor
TLDR
Watch directory for changes
SYNOPSIS
fswatch [options] paths...
DESCRIPTION
fswatch is a cross-platform file change monitor that detects filesystem changes and outputs affected paths. It uses native platform APIs (inotify on Linux, FSEvents on macOS, kqueue on BSD) for efficient monitoring.
The tool outputs changed file paths to stdout, which can be piped to other commands for automated workflows like rebuilding projects, running tests, or reloading services. It supports recursive monitoring and filtering by file patterns.
fswatch is useful for development workflows, build automation, backup triggers, and any scenario where actions should be triggered by file modifications.
PARAMETERS
-o, --one-per-batch
Print single event per batch (for counting).-r, --recursive
Recurse into subdirectories.-t, --timestamp
Print timestamps with events.-l seconds, --latency= seconds
Set latency (debounce period).-1, --one-event
Exit after first event.-0, --print0
Separate paths with NUL character.--event type
Filter by event type.--include regex
Include only matching files.--exclude regex
Exclude matching files.-m monitor, --monitor= monitor
Use specific monitor backend.-v, --verbose
Verbose output.-n, --numeric
Print numeric event codes.
CAVEATS
System limits on inotify watches may affect large directory monitoring (adjustable via /proc/sys/fs/inotify/maxuserwatches). Different backends have different capabilities. Latency affects responsiveness vs. batching trade-off.
HISTORY
fswatch was created by Enrico M. Crisostomo in 2014 to provide a unified, cross-platform file monitoring solution. It was designed to replace platform-specific tools with a single utility that uses native APIs. The project continues to be maintained and supports Linux, macOS, Windows, and BSD systems.
SEE ALSO
inotifywait(1), entr(1), watchexec(1), watchman(1)
