---
name: "reflex"
section: "1"
platform: "linux"
package: "reflex"
version: "0.3.1-1+b17"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/reflex"
---

# reflex(1)

Run a command when files change

## NAME

Reflex - Run a command when files change

## SYNOPSIS

**reflex** \[OPTIONS\] \[COMMAND\]

## DESCRIPTION

Reflex is a small tool to watch a directory and rerun a command when certain files change. It's great for automatically running compile/lint/test tasks and for reloading your application when the code changes.

## OPTIONS

- **--all=*True\|False***

  Include normally ignored files (VCS and editor special files). Defaults to False.

- **-c**, **--config=*FILE***

  A configuration file that describes how to run reflex (or '-' to read the configuration from stdin).

- **-d**, **--decoration=*DECORATION***

  How to decorate command output. Choices: none, plain, fancy. Default is plain.

- **-g**, **--glob=*GLOB\_LIST***

  A shell glob expression to match filenames. (May be repeated.)

- **-G**, **--inverse-glob=*GLOB\_LIST***

  A shell glob expression to exclude matching filenames. (May be repeated.)

- **-R**, **--inverse-regex=*REGEX***

  A regular expression to exclude matching filenames. (May be repeated.)

- **--only-dirs=*True\|False***

  Only match directories (not files). Defaults to false.

- **--only-files=*True\|False***

  Only match files (not directories). Defaults to false.

- **-r**, **--regex=*REGEX***

  A regular expression to match filenames. (May be repeated.)

- **-e**, **--sequential=*True\|False***

  Don't run multiple commands at the same time. Defaults to false.

- **-t**, **--shutdown-timeout=*TIMEOUT***

  Allow services this long to shut down. Defaults to 500ms.

- **-s**, **--start-service=*True\|False***

  Indicates that the command is a long-running process to be restarted on matching changes. Defaults to false.

- **--substitute=*STRING***

  The substitution symbol that is replaced with the filename in a command. Defaults to "{}"

- **-v**, **--verbose=*True\|False***

  Verbose mode: print out more information about what reflex is doing. Defaults to false.

## EXAMPLES

Print each .txt file if it changes:

```
reflex -r '\.txt$' echo {}
```

Run [**make**(1)](/make/1.md) if any of the .c files in this directory change:

```
reflex -g '*.c' make
```

Build and run a server; rebuild and restart when .java files change:

```
reflex -r '\.java$' -s -- sh -c 'make && java bin/Server'
```
