I want to monitor every file change in a directory with inotifywait. inotifywait shall write to a FIFO buffer, which then can be read, leisurely. While experimenting with relatively huge amounts of events I encountered some bottlenecks, which I'd like to understand.The Changes are always caused by touch {0000..9999}testfile. The bottlenecks are in the form of not catching all the file events.When I redirect inotifywait's output to a file, everything gets logged as it should be.inotifywait -q -m ./ writing to the Terminal catches CREATE, OPEN, ATTRIB, CLOSE for about 5000 to 8000 files. I guess the write to screen is not fast enough to be non-blocking?If I pipe to cat (inotifywait... | cat | ... | cat), I finally get them all, at some point. So I guess the pipes are kind of buffering, but I don't really understand how this works, or even what to look up. Could someone, please explain this? I also played with a solution I found here. Using pv -q -B 1g as buffer (also buffer). inotifywait -q -m ./ | BUFFER | \while read line; do   # Do something with $line or ...   sleep 1doneHow can make sure every file event can be processed? I have a feeling my little play about bash voodoo found some deeper constraints, where I'd like to have more insights into.
Understanding inotifywait, pipes and buffers
bash;pipe;buffer;inotify