This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

Watchexec Cheatsheet

A quick reference guide for Watchexec CLI tool: watching extensions, restart and clear flags, debouncing, and ignore patterns.

· Published

watchexec is a simple, standalone tool that executes commands in response to file modifications.

Installation

macOS via Homebrew

brew install watchexec

Via Cargo (Rust)

cargo install watchexec-cli

Precompiled binaries for Linux and Windows are available from the Watchexec GitHub Releases.

Getting Started

# Run npm test whenever .js or .jsx files change
watchexec --exts js,jsx -- npm test
# Watch specific directories lib/ and test/
watchexec -w lib -w test -- npm test

Options & Flags

Flags

Flag Description
-c, --clear Clear screen before executing command
-r, --restart Restart process if it is still running

Options

Option Description
-s, --signal SIGKILL Signal sent to terminate existing process
-d, --debounce MS Debounce interval in milliseconds
-e, --exts EXTS Comma-separated list of file extensions
-i, --ignore PATTERN Ignore file or directory patterns
-w, --watch PATH Watch specific files or directories

References

Related topics