Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I log all the events performed on a particular directory?

I want to log the entry of each directory modified within some time duration. I am using find . -type d -mmin -5 command.

In addition to this, I want to put more details, when any directory is moved to another place, I need to add the below log details, eg.,

directory "xyz" moved from "home/usr/xyz" => to "home/usr/documents/xyz"
share|improve this question

If using Linux, you should try inotifywait command, it's designed to listen events on files or directories.

inotifywait -m -r /dir

You can use a while loop over that to filter the output.

Moreover, it's very light : no need to poll() every N seconds, that's all the magic.

See http://inotify-tools.sourceforge.net/

share|improve this answer
URL project doc added. – Gilles Quenot Oct 7 '12 at 20:26
inotify is Linux specific but the question is not tagged Linux. Good solutions are going to be OS specific like this one though. – jordanm Oct 7 '12 at 22:38
it works, Thanks – Ghanshyam Rathod Oct 10 '12 at 14:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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