LinuxCommandLibrary

entr

TLDR

Run command when file changes

$ ls [*.py] | entr [python test.py]
copy
Clear screen before running
$ ls [*.md] | entr -c [make html]
copy
Restart command on change
$ ls [main.go] | entr -r [go run main.go]
copy
Run once and exit
$ ls [config.yml] | entr -p [./deploy.sh]
copy
Use tracked file in command
$ ls [*.js] | entr -s '[eslint /_]'
copy

SYNOPSIS

entr [options] command [args...]

DESCRIPTION

entr runs commands when files change. It watches files listed on stdin and executes the specified command whenever any change is detected.
The tool is ideal for development workflows: rerunning tests, rebuilding projects, or restarting servers on source changes. The -r flag handles processes that need restart rather than re-execution.
entr uses efficient kernel file notification mechanisms (kqueue, inotify) rather than polling.

PARAMETERS

COMMAND

Command to run when files change.
-c
Clear screen before running.
-r
Restart persistent process.
-p
Postpone first execution.
-s
Execute with shell.
-d
Track directories for new files.
-z
Exit on process completion.
/_
Placeholder for changed file.

CAVEATS

File list is fixed at startup (use -d for new files). stdin must list files. Some editors may not trigger events properly. Maximum file count limited by system.

HISTORY

entr was created by Eric Radman as a simple, Unix-philosophy tool for file watching. It focuses on doing one thing well: running commands when files change.

SEE ALSO

Copied to clipboard