Detecting file system changes on Linux & BSD

Watching the file system for changes comes useful from time to time. For example: checking an FTP/SFTP/rsync directory for newly uploaded files from some external system, looking for new core dumps, and detecting new lines in an error log file. Other use cases might include waiting for a process (or pipeline) to complete its job and save the results to a file, or very crude web server hacking…