Monitoring

reflex – rerun commands when files change

reflex is a command-line utility that monitors files and directories and executes commands when matching changes occur. It is intended for development workflows that require frequent compilation, testing, linting or restarting of applications.

The program watches the current directory and uses configurable patterns to determine which changes should trigger execution. Both shell-style glob patterns and regular expressions are supported, making it possible to target particular source files while excluding generated content or unrelated directories.

reflex also accommodates long-running processes such as development servers. Rather than starting another copy of a command whenever a file changes, it can terminate and restart the existing process.

A configuration file allows multiple monitoring rules to be defined together. This is useful when a project has several independent development tasks, such as compiling stylesheets, rebuilding application code and restarting a server.

This is free and open source software.

Key Features

  • Monitor directories for filesystem changes.
  • Execute commands automatically when matching changes occur.
  • Filter monitored files using shell glob patterns.
  • Supports regular-expression matching.
  • Inverse glob and regular-expression filters exclude unwanted files.
  • Automatically ignores common editor and version-control files.
  • Optionally include normally ignored files.
  • Substitute the changed filename into the executed command.
  • Customisable filename substitution token.
  • Service mode starts long-running commands and restarts them when files change.
  • Configurable timeout for stopping long-running services.
  • Configuration files define multiple independent monitoring commands.
  • Supports sequential execution of commands where required.
  • Can restrict matching to files or directories.
  • Configurable command output formatting and verbose mode.
  • Cross-platform support – runs on Linux and macOS.

Website: github.com/cespare/reflex
Support:
Developer: Caleb Spare
License: MIT License

reflex help

reflex is written in Go. Learn Go with our recommended free books and free tutorials.

Alternatives to watch


Explore Linux

Best Free and Open Source Software - A huge collection of recommended free and open source software covering every major category.
In-depth Linux Software Reviews - Detailed assessments of Linux software covering features, usability and overall quality.

The Big List of Active Linux Distros - An extensive collection of actively developed Linux distributions.
Open Source Alternatives - Alternatives to software and services from Google, Microsoft, Apple, Adobe, IBM, Autodesk, Oracle and others.
Essential Linux System Tools - Indispensable utilities for monitoring, maintaining and managing Linux systems.
Linux Productivity Tools - Useful utilities for improving productivity and streamlining everyday tasks.
Alternatives to Popular CLI Tools - Modern alternatives to familiar command-line utilities supplied with Linux systems.
Awesome Free Linux Game Tools - Tools, utilities and companion software that improve gaming on Linux.
Machine Learning on Linux - Machine learning and deep learning software, self-hosted applications and practical tools.
Saving Money with Linux - Practical ways to reduce electricity consumption and lower computing costs with Linux.
Linux Candy - Fun, entertaining and sometimes delightfully quirky software from the lighter side of Linux.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted