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.

Della
  • 505

1 Answers1

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.

Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497