2

In my present working directory, there is a subdirectory called modelled_data

I wish to get information on last few (may be 10) modifications of the subdirectory (including its subdirectories and files), specifically, the timestamps and types of modifications. Is it available via the terminals? Which commands or options should I try? ls -la gives a list of last modifications of all the subdirectories in the pwd. But I want last few modifications of a specific directory that I want to track.

  • 3
    There's no such logs. You can only see last modification time with stat command. Of course you can set up your own script to monitor a particular directory and events that occur. But no, there's no existing logs – Sergiy Kolodyazhnyy Nov 8 '18 at 3:39
  • @wjandrea Will do so by Sunday morning. Thanks. – Sergiy Kolodyazhnyy Nov 9 '18 at 3:02
2

There's no such logs. You can only see last modification time with stat command. That said, you can use inotifywait command from inotify-tools package. Example of its usage can be found on one of my other answers. Alternatively, you could use watchdog Python package. An example of usage is shown in watchdog's documentation. The output looks as so:

2018-11-10 21:32:45 - Modified directory: ./.config/Qlipper
2018-11-10 21:32:45 - Modified file: ./.config/Qlipper/qlipper.ini.lock
2018-11-10 21:32:45 - Created file: ./.config/Qlipper/qlipper.ini.yJ1483

You can start this as command python3 watchdog_example.py >> /var/log/my_directory.log & from /etc/rc.local and viola - you've got yourself a directory event logger that just works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.