빠른 참조

Watchexec 파일 감시 및 자동 명령어 재실행 치트시트

파일 변경 감지 시 명령어를 자동 재실행하는 Watchexec 퀵 가이드: 감시 확장자 지정(-e), 프로세스 재시작(-r), 화면 지우기(-c) 및 무시 패턴 설정.

· 게시일

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

관련 주제