entr
Run commands when files change
TLDR
Rebuild with make if any file in any subdirectory changes
Rebuild and test with make if any .c source files in the current directory change
Send a SIGTERM to any previously spawned ruby subprocesses before executing ruby main.rb
Run a command with the changed file (/_) as an argument
[c]lear the screen and run a query after the SQL script is updated
Rebuild the project if source files change, limiting output to the first few lines
Launch and auto-[r]eload a Node.js server
SYNOPSIS
entr [-cnpdrx] [-g pattern] [-t timeout] command [files...]
PARAMETERS
-c
Clear screen before executing command
-d
Execute command once immediately, without waiting for changes
-g pattern
Monitor files matching shell glob pattern
-n
Skip execution if command stdout would be empty
-p
Pause and prompt before executing command
-r
Restart command if already running
-t timeout
Exit if command exceeds timeout seconds
-x
Exit entr when command exits
-z
Run command in background, print PID
DESCRIPTION
entr is a lightweight command-line tool designed to execute arbitrary commands in response to filesystem events, such as file modifications, creations, or deletions. It uses efficient event notification mechanisms like inotify on Linux, kqueue on BSD/macOS, and polling as a fallback on other systems, making it cross-platform and performant.
Primarily used in development workflows, entr automates tasks like recompiling code, running tests, linting, or reloading servers. A typical invocation pipes a list of files to entr: find src/ -name '*.rs' | entr cargo test. This triggers the command only when relevant files change, saving time and reducing manual intervention.
Unlike more complex tools, entr's simplicity shines—no configuration files or daemons required. It supports glob patterns, timeouts, screen clearing, and restart modes for long-running processes. However, it processes stdin for files if no arguments given, enabling flexible scripting with find, ls, or shell globs.
With low overhead and single-binary distribution, entr is ideal for CI/CD, local dev, and scripting, enhancing productivity without bloat.
CAVEATS
High CPU usage possible with many files or rapid changes; use -d or globs to limit scope. Not recursive by default—pair with find(1). Limited to one command per invocation.
EXAMPLES
ls *.go | entr -c go run .
Clear screen and rerun Go app on .go changes.
find . -name '*.py' | entr pytest
Run tests when Python files change.
entr -r -d make
Restart make continuously during development.
HISTORY
Developed by Eric Wendelin in 2013 as a simpler alternative to tools like inotify-tools. Written in C for portability, actively maintained on GitHub with versions supporting modern filesystems. Gained popularity in Rust/Go dev communities for hot-reload workflows.
SEE ALSO
inotifywait(1), watchexec(1), fswatch(1)


