File watcher CLI that reruns commands or restarts a child process when watched files change.
$./configure && make test && make install
AI Analysis
entr watches a list of files from stdin and runs a command when one of them changes. It is a small local-development primitive for rebuild, test, query, or server-reload loops without polling.
What It Enables
- Re-run tests, builds, linters, or database queries whenever a watched file changes.
- Restart a long-lived process such as a dev server or worker with
-r, so code changes trigger a clean reload. - Watch parent directories for added or removed files with
-dand pass the first changed path into the command with/_.
Agent Fit
- Works well as shell glue around other CLIs because commands, flags, exit behavior, and stdin-driven file lists are simple and predictable.
-ngives a non-interactive mode and-zcan return the child process status, but there is no JSON or other structured output to inspect.- Best for local edit-build-test or auto-reload loops where an agent wants the shell to stay reactive between file changes.
Caveats
- It only watches the file list you pipe in; recursive discovery and glob refresh usually come from
find,ls, or a surrounding shell loop. - Default mode opens a TTY for the child process, so unattended usage should generally opt into
-nand use commands that behave well when restarted.