Super User is a question and answer site for computer enthusiasts and power users. 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

What would be a good way, via the Bash command-line, to find the time of the last modification made to any of the files in a particularly directory?

Basically, I'm working on a project where all the project's files are within one directory, and I'm keeping a timesheet, and I forgot to note when I finished working on the project earlier today. Whichever file was modified last will give me that time.

I could guess at the time... but I thought it would be fun to get Bash to give me a more accurate answer :)

As an added bonus, I think the command will likely need to ignore certain directories, in particular the .git directory in this case.

share|improve this question
up vote 2 down vote accepted

I'm not sure what you're after, but this should work for quick checks:

ls -tl
share|improve this answer
I usually use ls -ltr so that the newest are at the bottom, it makes it easy to see them when there's a lot of files scrolling by. – ZimmyDubZongyZongDubby Jan 7 '10 at 20:01

I prefer ls -lrt, especially if there are lots of files. The t says to sort by modification time, and the r says to reverse the sort. This way the newest files are listed last, and will still be in the window without scrolling.

share|improve this answer

To narrow down a guess (here 50 minutes ago) while looking recursively in a directory structure and excluding a couple of paths:

find -name .git -prune -o -name another_exclusion -prune -o \( -newermt "now - 50 min" -ls \)
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .