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

When I run ls -l in Bash shell, it lists a modification time for both files and directories. As noted in this thread, the modification time for directories does not reflect all of its contents. It also does not seem to be affected by changing the name of the directory. What exactly does the modification time for a directory reflect?

Is it the latest modification time of a file (or directory) in the top level of the directory?

share|improve this question

migrated from Feb 4 '14 at 14:03

This question came from our site for professional and enthusiast programmers.

up vote 9 down vote accepted

Note that, in Unix, a directory does not "contain" the files in it. Rather, it contains links to them. See the link(2) system call for further information.

This means that the "direct" contents of a directory is a list of filenames and corresponding i-numbers. The modification date of the directory, therefore, indicates whenever this list changed. Operations that would cause such changes would include, but not necessarily be limited to, the following:

  • Creating a new file in the directory
  • Removing (or, rather, unlink(2)ing) a file from the directory
  • Renaming a file in the directory
  • Hard-linking a file elsewhere into the directory
share|improve this answer

Think of directory as of simple file containing list of other files. Whenever you change its contents (rename files, add or remove contained files) the modification time of a directory changes.

share|improve this answer

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.