I need to watch a file system for the creation of new files of a specific type. Thinking that this would be a perfect use case for inotifywatch, I set out to try and make something work. I went to the man pages for the program, tried to implement things, got errors.. then tried to run their basic example.

inotifywatch -v -e access -e modify -t 60 -r ~/

I got the same eorror which was

Establishing watches...
OK, /home/mcamp is now being watched.
Total of 27243 watches.
Finished establishing watches, now collecting statistics.
Will listen for events for 30 seconds.
total access modify filename
Segmentation fault (core dumped)

What's causing this? inotifywait works for a single file.. I haven't had any luck with google. Has anyone else seen this error before and know how to handle it?


  • 1
    Perhaps it has something to do with the even queue overflowing, as stated in the man page. There may be far too many files changing! It would help if you told us how quickly the segfault happens.
    – Bib
    Commented Sep 15, 2021 at 18:18
  • 1
    You can still use inotifywait in monitor mode using the -m option (and a loop, in shell or any other language). eg: unix.stackexchange.com/questions/24952/… . caveat: special characters in filenames might not be easy to handle
    – A.B
    Commented Sep 15, 2021 at 20:42
  • thanks yea I just figured that out... and got it all working now.
    – Matt Camp
    Commented Sep 16, 2021 at 13:08

1 Answer 1


as mentioned in the comments I was able to get things working an alternative way using inotifywait. An example of what I did is below:


function execute() {
   echo "Do Stuff like ping an Airflow API: $@"

inotifywait -r --include "\.wav|\.mp3" \
     --monitor \
     --event create \
     --event move \
     --event delete \
     --format %e,%w%f \
     ~/ \
| while read; do
      execute "${REPLY% }"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .