LinuxCommandLibrary

reflex

Run commands when files change

TLDR

Watch and run command

$ reflex [command]
copy
Watch specific pattern
$ reflex -r '\.go$' [go build]
copy
Watch directory
$ reflex -d [src/] [command]
copy
Multiple patterns
$ reflex -r '\.go$' -r '\.html$' [command]
copy
Start without initial run
$ reflex -s [command]
copy
Decoration mode
$ reflex -d [.] -- [sh -c "echo changed"]
copy
Exclude pattern
$ reflex -r '\.go$' -R 'vendor/' [command]
copy

SYNOPSIS

reflex [-r regex] [-d dir] [-R exclude] [options] command

DESCRIPTION

reflex watches files and runs commands on changes. It's a flexible file watcher for development.
Regex patterns filter which files trigger. Multiple patterns combine for complex matching.
Service mode runs a long-running process. The process restarts on changes.
Exclusions ignore vendor directories or build output. Prevents unnecessary rebuilds.
Configuration files define complex watch rules. Multiple watchers in one file.

PARAMETERS

-r REGEX

Include pattern.
-R REGEX
Exclude pattern.
-d DIR
Watch directory.
-s
Start service (no initial run).
-g GLOB
Glob pattern.
-c CONFIG
Config file.
--all
Match all files.
--decoration MODE
Output decoration.

CONFIGURATION

.reflex

Project-level configuration file defining watch rules, one per line, with regex patterns and commands. Loaded automatically when present in the current directory.

CAVEATS

Polling fallback on some filesystems. Rapid changes may batch. Initial run may not be wanted.

HISTORY

Reflex was created as a simple, flexible file watcher. It focuses on development workflow automation with minimal configuration.

SEE ALSO

entr(1), watchman(1), fswatch(1), inotifywait(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community