To receive notifications about events such as file creation, opening, changing, etc., see inotify . A good way to use it from bash is the inotifywait command - here is its man page. It will block until an event you worry about occurs. For example:
inotifywait -e create /path/to/watch echo "ding!"
will be displayed when creating a file or directory in this path. See the man page for more details.
source share