Here’s how to monitor file system changes in Linux in real time:
1. Issue the following command at the terminal –
watch -d -n 1 ‘df; ls -FIAt;’
The above command will monitor your file system for any changes and will refresh the information every second. If you want to change the interval of information refresh, change to value after ‘n’ to some other number. For example, to refresh the information every 10 seconds, issue the following command – watch -d -n 10 ‘df; ls -FIAt;’
2. Now let us test if the command really works. Note the file named ‘aYAGB11YrSs.webm’ in our home folder. As soon as we delete the file, the information is updated on the screen.
3. Also, notice that we immediately got an updated information about 3 new files copied in to the home folder. A large change in ‘Used’ and ‘Available’ capacity of the mounted file systems also alerts you about any changes in the file system (large amount of data being copied / deleted).