Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Basically the question is in the title. I want to monitor a directory for new files that are written or deleted, the way I can monitor a log file with tail -f. Is this possible?

share|improve this question
up vote 15 down vote accepted

Try watch.

Taken from here:

watch -d ls -l

A friend and I tried this a moment ago, it seems that the highlighting doesn't really work correctly, it will highlight a seemingly random selection. I've tried this in an OS X Terminal ssh'd to a RHEL5 machine and my friend has tried in a Ubuntu GUI terminal.

Unfortunately inotifywait is not present on the RHEL5 machine so I can't give any information on the effectiveness of that command.

share|improve this answer
inotifywait is part of inotify-tools. – grawity Jun 20 '12 at 13:27
Thanks. Looks like it's probably the preferred solution, especially with a system that you can add binaries to. – arpz Jun 20 '12 at 14:58
Put the command in quotes if the commands has one or more pipes. watch -d "ls -l | grep avi". – Bibhas Sep 18 '13 at 21:58

inotifywait from inotify-tools shows a real-time log of file modifications, similar to tail -f.

inotifywait -m -q -e create,delete,move /dir

-r can be added for recursive watches (can be a little slow with many subdirectories), --format to change the output format (e.g. add timestamps or join the path & filename).

Example output:

/home/grawity/code/bin/ CREATE,ISDIR fallback
/home/grawity/code/bin/ CREATE gnome-inhibit-list
/home/grawity/code/bin/ CREATE k5translate
/home/grawity/code/bin/ MOVED_FROM logout
/home/grawity/code/bin/ DELETE pacman-sigstats

(By the way, tail -f also uses inotify to follow file changes.)

share|improve this answer
Thanks for the additional information grwaity. – arpz Jun 20 '12 at 13:40

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.