Watch files and run commands automatically with entr and find
8 steps · about 1 h 51 min · Beginner
- entr: Run arbitrary commands when files change (doc, Eric Radman, 10 min)
Explains the Unix-pipe design of entr, where a list of file paths on stdin triggers any command on save.
- eradman/entr source and flags (repo, GitHub, 12 min)
Documents key flags like -c (clear screen), -r (restart server), and -d (exit when new files appear in directories).
- Greg's Wiki: Using find (guide, Wooledge Wiki, 18 min)
Shows how to select only the source files you want to watch and exclude build or dependency directories cleanly.
- GNU Findutils Manual (reference, GNU, 20 min)
Covers find predicates, pruning rules, and safe path output formatting for feeding file watchers.
- Bash Reference: Filename Expansion (doc, GNU, 12 min)
Clarifies how shell globbing expands file patterns versus passing patterns into find or a watcher.
- BashGuide: Commands and Arguments (guide, Wooledge Wiki, 15 min)
Prevents quoting bugs when passing commands and file arguments into a watcher loop.
- inotifywait(1) — Linux manual page (reference, man7.org, 12 min)
Introduces the underlying Linux file-event tool for cases where you need event names or custom shell loops.
- watchexec: Execute commands in response to file modifications (repo, GitHub, 12 min)
Presents a cross-platform alternative to entr with built-in ignore-file support and debouncing.