The tool fswatch is free and open source, in addition to being multiplatform as it can be installed on numerous operating systems such as GNU / Linux, Solaris, BSDs, Mac OS, and even on Microsoft Windows. It is a simple but powerful tool that can monitor and alert of changes in directories and files when they are modified. In the case of the Linux version, it is based on inotify, a kernel subsystem that reports on file changes.
Unfortunately the package it is not included by default in any repository from any distribution, so you will have to download, compile and install it manually if you want to have this fantastic tool on your system. Of course, for this you must have the Development Tools installed on your Linux distribution, which are generally found in most distros, so this would not be a problem for you for sure.
fswatch can monitor in idle periods, customize the event recording format, use filters using regular expressions for the command, recursive directory monitoring, etc. Well then, to install it you must do the following:
wget https://github.com/emcrisostomo/fswatch/releases/download/1.9.3/fswatch-1.9.3.targ.gz tar -zxvf fswatch-1.9.3.tar.gz cd fswatch-1.9.3/ ./configure make sudo make install sudo ldconfig
By the way, the last command is necessary to refresh the links and library cache, otherwise we would find an error type:
fswatch: error while loading shared libraries: libfswatch.so.6: cannot open shared object file: No such file or directory.
Now you have it installed, you can use it. I advise you to check the manual, but the basic syntax is:
fswatch [opciones] /rutas/a/monitorizar
For example, to monitor the home directory:
fswatch /home/isaac
In addition, as you will see in the manual, it has a multitude of interesting options to modify its behavior ... I hope you liked it and that it will help you.