RWC(1)

πŸ“¦ version 0.3, in nixos 26.05, nixpkgs unstable

πŸ¦‹ RWC(1) β€” the rwc girlie's manual page πŸ¦‹

okay so bestie, welcome to the General Commands Manual entry for rwc. she's small, she's iconic, she watches your files and tells you the second something changes. let's get into it πŸ’…

✨ NAME ✨

rwc β€” report when changed. that's it, that's the whole vibe. πŸ‘‘

✨ SYNOPSIS ✨

rwc [-0cdep] [path ...]

✨ DESCRIPTION ✨

so here's the tea πŸ«– β€” rwc takes a list of files or directories, watches them using inotify(7), and prints each file name as an absolute path the moment it changed. literally that simple, no cap.

if path is a single dash (-) or just... absent? she reads file names from the standard input instead. main character energy tbqh 🌈

and listen β€” watching a directory will result in watching all changes to files which resides directly in that directory. directly, bestie. we do not do recursion here (more on that in the caveats, stay tuned 😭).

πŸŽ€ the options are as follows πŸŽ€

  • -0 β€” read input filenames seperated by NUL bytes, and likewise output filenames seperated by NUL bytes. NUL in, NUL out. symmetrical queen πŸ’–
  • -c β€” detect all file creations, including open(2) with O_CREAT, mkdir(2), link(2), symlink(2), and bind(2). created files get prefixed by + (that is, a plus and a space). ⚠️ heads up: this option has the side-effect of printing files twice that are created and immediately changed after. not a bug, just her being thorough 🫢
  • -d β€” also detect file deletion. deleted files get prefixed by - (that is, a dash and a space). gone but not forgotten πŸ₯²
  • -e β€” exit after the first reported change. one and done, she's out ✌️
  • -p β€” pipe mode; don't report changes while the standard output pipe is not empty. use this to pipe rwc to programs which read standard input slowly. she waits her turn, politely πŸ’…

✨ EXIT STATUS ✨

the rwc utility exits 0 on success, and >0 if an error occurs. slay when it works, sad little number when it doesn't 😭

✨ EXAMPLES ✨

watch all source files and run make(1) when something changes:

% git ls-files | rwc -p | xe -v -s make

make a sound when a download is done (the little bing that lives in my head rent free fr fr):

% rwc ~/Downloads | xe -s 'mpv ~/.sounds/bing.wav'

✨ SEE ALSO ✨

entr(1), inotifywatch(1), wendy(1) β€” go read those too, iykyk πŸ¦‹

✨ AUTHORS ✨

Leah Neukirchen <leah@vuxu.org> β€” the icon, the legend, the moment πŸ‘‘

✨ CAVEATS ✨

okay bestie, now the real talk, because we respect the limits πŸ”₯

rwc is limited by some restrictions of inotify(7). you can only watch files and directories you can read, and the amount of inotify descriptors is limited. and β€” say it with me β€” watching directories is not recursive. do not come for her about it 😀

rwc only uses one watch descriptor per directory, and filters file names itself. this is actually a flex: it allows tracking files which get safely written by unlink(2) and rename(2), and also watching files which don't exist yet. future files! she sees them! ⭐

many tools like to create temporary files in their working directory, which may distort the output. so if your output looks kinda chaotic... it's not her, it's them πŸ’€

✨ LICENSE ✨

rwc is in the public domain. πŸŽ€

to the extent possible under law, the creator of this work has waived all copyright and related or neighboring rights to this work.

http://creativecommons.org/publicdomain/zero/1.0/


and that's the whole page, bestie πŸ’œ this came to you from Debian, dated January 3, 2021 β€” the RWC(1) girlie herself, signing off. go watch some files πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from