To monitor a specific file or directory with a particular monitor option, run: $ swatch -m kqueue_monitor /home/sk/īy default, fswatch will keep monitoring the file changes until you manually stop it by invoking CTRL+C keys. To list the available monitors in the current platform (i.e Linux in our case), run: $ fswatch -M In Linux, the default monitor is inotify. Terminal 2 - Do some random changes in files/folders:īy default fswatch will choose the best monitor available on the current platform, in terms of performance and resource consumption. Terminal 1 - fswatch command is running and the file changes are being monitored: Have a look at the following screenshots. Whatever you do in the terminal 2 will be notified on the Terminal 1. $ fswatch /home/sk/Īnd, in the Terminal 2 do some operations such as creating files/folders, deleting files, modifying files etc. In Terminal 1, run the fswatch command to monitor the $HOME directory. To test how fswatch works, open two Terminal windows (Let us call them Terminal 1 and Terminal 2). The typical syntax of fswatch is: $ fswatch. fswatch: error while loading shared libraries: libfswatch.so.6: cannot open shared object file: No such file or directory fswatch usage If you don't run the above command, you might get the following error in GNU/Linux systems. configure $ make $ sudo make installįinally, run the following command to refresh the links and cache to the dynamic libraries: $ sudo ldconfig
Go to the project's folder: $ cd fswatch-1.9.3/įinally, compile and install fswatch by running the following commands one by one. $ wget Įxtract the downloaded tarball: $ tar -zxvf fswatch-1.9.3.tar.gz
Then, download the fswatch source file from here.
How To Install Development Tools In Linux.To install Development tools on various Linux distributions, refer the following guide. Since the fswatch utility is not available in the default repositories of most Linux distributions, you need to manually compile and install the latest version from the source as described below.īefore compiling, you need to install Development tools in your Linux distribution. Monitor File Changes Using fswatch In Linux Path filtering using including and excluding regular expressions.Cross-platform and open source utility.A monitor which periodically stats the file system, saves file modification times in memory, and manually calculates file system changes.Ĭoncerning about the features, we can list the following:.