watchman(1)

πŸ’– watchman β€” the file watching service, bestie edition πŸ’–

okay so you're here for watchman(1), the manual page for watchman, which is literally a file watching service. sit down, grab a boba, we're doing this πŸ§‹βœ¨


✨ NAME ✨

watchman β€” a file watching service. that's it, that's the name, she's simple and she's iconic πŸ’…


🌸 SYNOPSIS 🌸

watchman [--OPTION ...]  COMMAND

yeah that's the whole shape of it β€” options, then a command, periodt.


πŸ¦‹ DESCRIPTION πŸ¦‹

so watchman can recursively watch one or more directory trees β€” we also call those roots, iykyk.

and listen, this part matters: Watchman does not follow symlinks. she knows they exist, bestie, but they show up the same as any other file in its reporting. and she will wait for a root to settle down before she'll start triggering notifications or running commands. patience is a virtue πŸ’…

Watchman is conservative, preferring to err on the side of caution β€” she considers files to be freshly changed when you start to watch them, or when she's unsure. no cap, she'd rather over-report than miss a thing.

you can query a root for file changes since you last checked, or for the current state of the tree. and β€” this is the good part β€” Watchman lets you subscribe to file changes that occur in a root. obsessed. 🫢


πŸŽ€ USAGE πŸŽ€

here's the vibe. this example establishes a watch on a source directory, then sets up a trigger named buildme that will run a tool named minify-css whenever a CSS file is changed. the tool gets passed a list of the changed filenames. iconic behaviour fr fr.

watchman watch ~/src

and the single quotes around '*.css' are important, do not skip them:

watchman -- trigger ~/src buildme '*.css' -- minify-css

the output for buildme will land in the Watchman log file unless you send it somewhere else. To use

(no bestie, that last sentence just ends there in the original. she said what she said. πŸ’€)

πŸ’… OPTIONS πŸ’…

  • -h, --help β€” show this help πŸ₯°
  • --inetd β€” spawning from an inetd style supervisor
  • -v, --version β€” show version number
  • -U, --sockname=PATH β€” specify alternate sockname
  • -o, --logfile=PATH β€” specify path to logfile
  • --log-level β€” set the log level (0 = off, default is 1, verbose = 2) πŸ“ˆ
  • --pidfile=PATH β€” specify path to pidfile
  • -p, --persistent β€” persist and wait for further responses πŸ‘€
  • -n, --no-save-state β€” don't save state between invocations
  • --statefile=PATH β€” specify path to file to hold watch and trigger state
  • -j, --json-command β€” instead of parsing CLI arguments, take a single json object from stdin
  • --output-encoding=ARG β€” CLI output encoding. json (default) or bser
  • --server-encoding=ARG β€” CLI<->server encoding. bser (default) or json
  • -f, --foreground β€” run the service in the foreground
  • --no-pretty β€” don't pretty print JSON
  • --no-spawn β€” don't try to start the service if it is not available
  • --no-local β€” when no-spawn is enabled, don't try to handle request in client mode if service is unavailable

πŸ‘‘ AVAILABLE COMMANDS πŸ‘‘

the full roster, no skips, main character energy only:

  • clock
  • debug-ageout
  • debug-contenthash
  • debug-drop-privs
  • debug-get-subscriptions
  • debug-poison
  • debug-recrawl
  • debug-set-subscriptions-paused
  • debug-show-cursors
  • find
  • flush-subscriptions
  • get-config
  • get-pid
  • get-sockname
  • list-capabilities
  • log
  • log-level
  • query
  • shutdown-server
  • since
  • state-enter
  • state-leave
  • subscribe
  • trigger
  • trigger-del
  • trigger-list
  • unsubscribe
  • version
  • watch
  • watch-del
  • watch-del-all
  • watch-list
  • watch-project

🌈 SEE ALSO 🌈

for more information, please refer the online documentation πŸ”₯


and that's the whole page, bestie πŸŽ€ this one's from the Linux corner of the world, dated 8 Oct 2019, and it's the watchman(1) page β€” mwah, slay, go watch some files πŸ’–βœ¨πŸ¦‹