How do I create a file listener in linux? How do I create a file listener in linux? linux linux

How do I create a file listener in linux?


To get notified about events like file creation, opening, modifying etc. look into inotify. A good way to use it from bash is with the inotifywait command - here is its man page. It will block until an event you care about happens. For example:

inotifywait -e create /path/to/watchecho "ding!"

will ding when a file or directory gets created in that path. See the man page for more details.