ENTR(1)

πŸŽ€ ENTR(1) πŸŽ€

okay so welcome to the ENTR(1) page, straight out of the General Commands Manual, section 1, bestie β€” this is the whole thing, every last flag, no skips, no cap πŸ’…


✨ NAME ✨

entr β€” run arbitrary commands when files change πŸ¦‹


🌸 SYNOPSIS 🌸

entr [-acdnprsxz] utility [argument /_ ...]

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: you hand entr a list of files on standard input, and it runs the utility β€” with whatever arguments you gave it, if any β€” the moment any of those files change. That's it. That's the whole personality. πŸ”₯

entr waits for the child process to finish before it responds to subsequent file system events (patience is a virtue, okay?). And it also opens a TTY before entering the watch loop, specifically so interactive utilities actually work. thoughtful queen behavior πŸ‘‘

The arguments are as follows, and yes we're doing all of them:

  • -a β€” Respond to all events which occur while the utility is running. Without this option, entr consolidates events in order to avoid looping. Heads up though: this option has no effect in conjunction with the -r flag πŸ™ˆ
  • -c β€” Clear the screen before invoking the utility specified on the command line. Specify it twice to erase the scrollback buffer too. cleanliness is next-level 😭
  • -d β€” Track the parent directory of regular files provided as input. If specified twice, all new entries to a directory are recognized, otherwise files with names beginning with β€˜.’ are ignored 🫢
  • -n β€” Run in non-interactive mode. In this mode entr does not attempt to read from the TTY or change its properties. lowkey introvert mode 🌸
  • -p β€” Postpone the first execution of the utility until a file is modified. no premature moves πŸ’…
  • -r β€” Reload a persistent child process. As with the standard mode of operation, a utility which terminates is not executed again until a file system or keyboard event is processed. A process group is created to prevent shell scripts from masking signals. entr waits for the utility to exit to ensure that resources such as sockets have been closed. Control of the TTY is not transferred to the child process. iconic reload behavior, fr fr πŸ”₯
  • -s β€” Evaluate the first argument using the interpreter specified by the SHELL environment variable. shell girlies rise 🐚
  • -x β€” Format custom exit status messages using a persistent awk(1) process. The path to the status script is defined by the environment variable ENTR_STATUS_SCRIPT. If the status script does not exist, entr will create an example. Shell commands and file redirection is not permitted by default, but may be enabled by specifying -x twice ⚠️ (yes, twice. the double-flag pipeline is real)
  • -z β€” Exit after the utility completes. When combined with -r the utility will be restarted again only in response to commands or file system events. bye bestie πŸ‘‹

And the special little star of the show: the first argument named /_ is replaced with the absolute path of the first file to trigger an event. The first file under watch is used as the default. If the -s option is used, the name of the first file to trigger an event can be read from $0. πŸŽ€


⌨️ COMMANDS ⌨️

entr listens for keyboard input (it's listening, it cares) and responds to these:

  • ⟨space⟩ β€” Execute the utility immediately. If the -r option is set this will terminate and restart the child process as if a file change event had occurred. go go go ⭐
  • q β€” Quit; equivalent pressing ⟨control-C⟩.

🌈 ENVIRONMENT 🌈

  • ENTR_STATUS_SCRIPT β€” The path to the exit status script enabled by the -x option. By default $HOME/.entr/status.awk is evaluated.
  • ENTR_RESTART_SIGNAL β€” Signal used to terminate the utility. Supported signal names are HUP, INT, QUIT, TERM, USR1 and USR2. The default is SIGTERM. πŸ’€
  • EV_TRACE β€” Print file system event messages. little peek behind the curtain πŸ‘€
  • PAGER β€” Set to /bin/cat by default to prevent interactive utilities from waiting for keyboard input if output does not fit on the screen.
  • SHELL β€” Specify the shell to use with the -s flag. The default is /bin/sh.

πŸšͺ EXIT STATUS πŸšͺ

If the -z flag is set and the utility is successfully executed, the status of the child process is returned. If the child process was terminated by a signal, the exit status is the signal number plus 128.

entr normally returns one of the following values:

  • 0 β€” Normal termination after receiving SIGINT
  • 1 β€” No regular files were provided as input or an error occurred
  • 2 β€” Files were added or removed from a directory

πŸ’œ EXAMPLES πŸ’œ

Rebuild a project if source files change, limiting output to the first 20 lines:

$ find src/ | entr -s 'make | head -n 20'

Launch and auto-reload a node.js server:

$ ls *.js | entr -r node app.js

Clear the screen and run a query after the SQL script is updated:

$ echo my.sql | entr -cp psql -f /_

Rebuild project if a source file is modified or added to the src/ directory:

$ while sleep 0.1; do ls -d src src/*.rb | entr make; done

Auto-reload a web server, or terminate if the server exits

$ ls * | entr -rz ./httpd

πŸ‘‘ AUTHORS πŸ‘‘

Eric Radman <ericshane@eradman.com> β€” the main character who wrote this 🫢


this page was brought to you by the Debian girlies, version dated October 1, 2026, and yeah β€” that's the whole ENTR(1), every single detail intact, slay πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from