Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Print A File In The Terminal Every Time It Changes

Use this to output a file every time it changes

This uses `fswatch``. I've since converted over to using `watchexec`` which I find more robust.

Code

fswatch -0 ~/path/to/file.txt | xargs -0 -n1 cat

Some apps will update when files change, but lots of times they'll only do that if they are in focus. This command prints the file out to the terminal every time it changes.

  • Consolidate all the posts about `fswatch`