LinuxCommandLibrary

watchexec

Run arbitrary commands when files change.

TLDR

Call ls -la when any file in the current directory changes

$ watchexec [ls -la]
copy


Run make when any JavaScript, CSS and HTML file in the current directory changes
$ watchexec --exts [js,css,html] make
copy


Run make when any file in the lib or src directory changes
$ watchexec --watch [lib] --watch [src] [make]
copy


Call/restart my_server when any file in the current directory changes, sending SIGKILL to stop the child process
$ watchexec --restart --stop-signal [SIGKILL] [my_server]
copy

Copied to clipboard