HTTPS clone URL

Subversion checkout URL

Home

Pages 1

Clone this wiki locally

inotify-tools

inotify-tools is a C library and a set of command-line programs for Linux providing a simple interface to inotify. These programs can be used to monitor and act upon filesystem events. A more detailed description of the programs is further down the page. The programs are written in C and have no dependencies other than a Linux kernel supporting inotify.

inotify-tools 3.14 is the latest version, released on the 7th of March 2010.

Thanks to the hard work of a few people, some lucky users can also obtain inotify-tools through their distribution’s package manager. If your distribution is listed here but does not have the most up-to-date version, you can try pestering the listed package maintainer. If your distribution is not listed here but it does provide inotify-tools, let me know!

Fedora

inotify-tools is available through the Fedora Extras repository. Just do:

inotify-tools is written by Rohan McGovern (mail, web). The current version of inotify-tools is considered stable. As of 6th of June 2009 the project is maintained by Radu Voicilas (mail).

If you have a question which others could benefit from the answer to, or if you want to make suggestions about future development of inotify-tools, send mail to the mailing list. General queries about development with inotify are also welcome here.

libinotifytools

This library provides a thin layer on top of the basic inotify interface. The primary use is to easily set up watches on files, potentially many files at once, and read events without having to deal with low-level I/O. There are also several utility functions for inotify-related string formatting.

inotifywait

This command simply blocks for inotify events, making it appropriate for use in shell scripts. It can watch any set of files and directories, and can recursively watch entire directory trees.

inotifywait example 2

inotifywait will return true if an event you asked for is caught. If an event you didn’t ask for is caught, it will return false; this generally occurs if you listen to a file on a particular partition and the partition is subsequently unmounted, or if you listen for a specific event and the file is deleted before that event occurs.