Re: Native (small) inotifywait-like tool?

From: Mark Johnston <markj_at_freebsd.org>
Date: Wed, 05 Aug 2026 20:38:41 UTC
On Wed, Aug 05, 2026 at 04:43:12PM +0000, Bjoern A. Zeeb wrote:
> Hi,
> 
> do we have a native tool (can be way simpler) like inotifywait?
> 
> I am essentially looking for something which will trigger an action when a
> file changes; the action could also be in a shell script so "wait" in a shell
> script look would be acceptable.
> 
> Problem is that I am very space contraint and don't want to pull in more
> libraries etc. when a few kB would already do.
> 
> I assume soemthing like the example in kqueue(2) will almost do?
> 
> I am just wondering: we do not have a tool like this already in base?

Not as far as I know.  The inotify-tools package is pretty small though.

There is also /usr/share/examples/inotify/inotify.c, which could be
whipped into whatever shape you want pretty easily.  kqueue is fine for
monitoring a single file, not so much for monitoring a directory.