12

According to Wikipedia,

inotify is a Linux kernel subsystem which notices changes to the file system. It replaced the previous dnotify.

Programs that sync files (such as crashplan, dropbox, git) recomend in user guides that the user increase max_user_watches (1, 2, 3).

From what I understand about inotify, the OS is "told" that a file has been changed, instead of requiring the OS to "go looking" for changes.

I assume that there is an "inotify" file created in every directory. Is this correct? Is there a way to interact with inotify from the command line?

Resources
Why are inotify events different on an NFS mount?
Inotifywait for large number of files in a directory

  • You probably won't find the answers to your questions this way (at least, not easily) but you should run grep --exclude=arch -r inotify in the Linux kernel sources. – user26112 Jul 25 '13 at 2:07
19

Inotify is an internal kernel facility. There is no “inotify file”. There are dedicated system calls inotify_init, inotify_add_watch and inotify_rm_watch that allow processes to register themselves to be notified when certain filesystem events happen. When the event happens, the process receives a description of the event through the file descriptor returned by inotify_init.

The OS isn't “told” that a file has been changed: it knows, because it's doing the changing. It's the application that's told that a file has been changed instead of having to go looking.

The program inotifywait provides a simple way to use inotify from the command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.