Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

With the ls command, is it possible to show only the files created after a specific date, hour...?

I'm asking it because I have a directory with thousand of files.

I want so see all files that were created since yesterday.

I use ls -ltr but I have to wait to see all files...

There is an equivalent of DIRECTORY/SINCE=date from OpenVMS ?

share|improve this question
ls lists files, but it doesn't offer much to select what files to list or the output format. Use globbing (shell wildcards) or find when you want to select files by name or metadata (e.g. date). – Gilles Mar 24 '11 at 20:46
So how did the date with ls go? Did you two hit it off? – Garrett Albright Dec 4 '13 at 0:17
With zsh: ls -1 -- *(.m-1) – don_crissti Aug 8 '15 at 15:52
up vote 51 down vote accepted

You can use the find command to find all files that have been modified after a certain number of days.

For example, to find all files in the current directory that have been modified since yesterday (24 hours ago) use:

find . -maxdepth 1 -mtime -1

Note that to find files modified before 24 hours ago, you have to use -mtime +1 instead of -mtime -1.

share|improve this answer
The very thing I would have said. There's no reason to limit yourself to ls here, Luc. – Warren Young Mar 24 '11 at 16:04
With GNU find, there are other possibilities. -mmin 5 lists files modified in the last 5 minutes. -newermt "2011-02-27 13:42" lists files modified since the specified date. You can use -exec ls --color -ld {} + instead of -ls to get the usual color display (if you like colored ls output). – Gilles Mar 24 '11 at 20:44
Note the minus sign: find . -mmin -5 – user7543 May 17 '11 at 8:32
and -maxdepth 1 can be increased to any n value to search files under subdirectory level too – anshuman Sep 12 '12 at 5:42
This is great, except it lists the current directory . also. I had to run this through tail to strip that. Is there a way within find to chop one? – Geoff Dec 27 '12 at 12:44
ls -ltr | grep "`date | awk '{print $2" "$3}'`"
share|improve this answer
Hi Trant! While your solution is creative in attempting to respect the question's request to use ls, parsing the output of ls is seldom safe (e.g., what happens with file names including newlines here?), and we like it for answers to not be just one-liners, but rather to explain how they work in as much detail as is relevant. – dhag Apr 10 '15 at 15:58
Issues: (1) On my system, date says Jun 03, but ls says Jun  3, so this doesn’t work.  (2) A week ago, the date was May 27.  ls -l | grep "May 27" would find files modified that day, but also files modified May 27 of any other year — and files with “May 27” in their name.  (And if you think that’s a totally bogus concern, look up “Dec 10”.)  (3) And, if you managed to get date to say Jun 2, grepping for that would find Jun 20 through Jun 29, but not Jun  2 (with two spaces).  … (Cont’d) – G-Man Jun 4 '15 at 1:33
(Cont’d) …  (4) The OP was using ls -ltr to get the most recently modified files at the end of the listing.  If you’re grepping for a date, there’s no need to do that (except to get the May 27, 2015 files at the end of the listing, after the May 27, 2014, May 27, 2013, etc., files).  (5) In awk, print $2, $3 is equivalent to print $2" "$3, and is much easier to read — especially when there are three other levels of quotes. – G-Man Jun 4 '15 at 1:37

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.