How do I find file by date under UNIX and Linux?
Linux and UNIX like operating systems do not store file creation time. However, you can use file access and modification time and date to find out file by date.
ls Command Example
The syntax is as follows:
ls -l | grep 'yyyy-mm-dd' ls -l | grep --color=auto '2006-01-05'
Where,
- 2006 - Year
- 01 - Month
- 05 - Day
You can sort it as follows:
ls -lu | grep --color=auto '2006-01-05'
find Command Example
If you need a specific date range many days ago, than consider using the find command. In this example find files modified between Jan/1/2007 and Jan/1/2008, in /data/images directory:
touch --date "2007-01-01" /tmp/start touch --date "2008-01-01" /tmp/end find /data/images -type f -newer /tmp/start -not -newer /tmp/end
You can save list to a text file called output.txt as follows:
find /data/images -type f -newer /tmp/start -not -newer /tmp/end > output.txt
List ALL *.c File Accessed 30 Days Ago
Type the following command
find /home/you -iname "*.c" -atime -30 -type -f
See also:
- See -atime and -mtime FAQ for more information.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop









![HowTo: Use grep Command In Linux / UNIX [ Examples ]](http://s13.cyberciti.org/images/shared/rp/3/21.jpg)




{ 3 comments… read them below or add one }
There is an option to find, -newermt, which allows direct date comparisons. It is documented under the “-newerXY” option, where X and Y represent sub-options, which in this example are X=m for modified date, and Y=t for literal time. So for example, “find . -newermt “Sep 1 2006″ -and \! -newermt “Sep 10 2006″ will match all files modified between Sep 1 2006 and Sep 10 2006.
How to finad out the files existing with system date using find command.
You can try this,
ll -lrt or l -lrt