Find Files that are Modified Today (or Since Certain Time Ago) in Unix

To find all files that was modified since a specific time ago (i.e an hour ago, a day ago, 24 hours ago, a weeks ago and so on) in Unix environment, the find command will come in handy. The command syntax is:

To find all files modified in the last 24 hours (last full day) in current directory and its sub-directories:

find . -mtime -1 -print

Flag -mtime -1 option tells find command to look for files modified in the last day (24 hours). Flag -print option will cause find command to print the files’ location. -print can be replaced with -ls if you want a directory-listing-type response.

To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories:

find /directory_path -mtime -1 -print

The command is basically the same with the earlier command, just that now you no need to cd (change directory) to the directory you want to search.

To find all files with regular file types only, and modified in the last 24 hours (last full day) in current directory and its sub-directories:

find /directory_path -type f -mtime -1 -print

To find all files that are modified today only (since start of day only, i.e. 12 am), in current directory and its sub-directories:

touch -t `date +%m%d0000` /tmp/$$
find /tmefndr/oravl01 -type f -newer /tmp/$$
rm /tmp/$$

The first command can be modified to specify other date and time, so that the commands will return all files that have changed since that particular date and time.

13 Responses to “Find Files that are Modified Today (or Since Certain Time Ago) in Unix”

  1. edel
    February 4th, 2010 23:48
    13

    Merci, danke, thank you… clearly explained and put. Why can’t man be this simple to read?

  2. Mike
    June 30th, 2009 06:53
    12

    Question: If one does a find for files modified in the last two minutes, and it takes the command ten minutes to complete, is that going to fail completely?

  3. Bruno De Barros
    June 11th, 2009 15:46
    11

    @Kiran Kappeta, it works for me on Ubuntu. Try to see if it supports any non-integer values at all (for example, try 0.5 or 0.25). If it doesn’t, there’s your problem.

  4. Kiran Kappeta
    June 4th, 2009 21:02
    10

    Good one. Thanks.

    Tried

    find . -mtime -0.041666667 -print

    on Debian, it throws an error
    “find: invalid argument `-0.041666667′ to `-mtime’”

  5. Bruno De Barros
    June 4th, 2009 20:02
    9

    Additionally, to find files modified less than an hour ago:
    find . -mtime -0.041666667 -print

    Simply divide 1 by 24 (24 hours) and you’ll get what you want. For example, 0.1 is 2 hours and 24 minutes.

    I hope this helps whoever needs to find files modified LESS than one full day ago. :)

    —–
    Bruno De Barros

  6. Susmita
    May 14th, 2009 16:00
    8

    thanks a lot for the good article.

  7. Prabhakar
    February 20th, 2009 21:22
    7

    It was of timely help :)
    Thanks.

  8. RuBiCK
    December 12th, 2008 20:36
    6

    And how you will find files by specified hour?

    example. Files modified in last 8hours, if now, the time is 01AM

  9. Deiby
    November 12th, 2008 21:08
    5

    Thanks!!

  10. Recently Modified Files : mnavasca.ca
    October 1st, 2008 04:19
    4

    [...] be useful when I’m syncing files from our dev server to our production server. And thanks to this post I’ve finally found [...]

  11. Finding files modified since a certain time « Tech Notes @ Fernvale
    June 30th, 2008 11:46
    3

    [...] References: http://www.mydigitallife.info/2006/01/19/find-files-that-are-modified-today-or-since-certain-time-ag... [...]

  12. einstein
    May 7th, 2008 15:35
    2

    Very good article, thanx!

  13. iPAS
    August 4th, 2007 08:59
    1

    Great Thnks!

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to My Digital Life Comments RSS feed to receive notification of latest comments posted.

New Articles

Incoming Search Terms for the Article

linux find modified files - linux find files modified since - linux find files modified today - find files modified today - linux find date modified - linux find changed files - linux find files changed today - find modified files linux - linux find last modified files - unix find recent files - linux find last modified - linux find files modified - linux find all files modified today - find last modified files linux - find last modified files - find files changed today linux - unix find files changed today - unix find date modified - linux find files modified in last 24 hours - linux find modified time - find files created today - linux find file modified today - unix find file by date - unix find files modified today - find files modified today linux - find last modified - find all files modified in the last 24 hours - linux find recently modified files - linux find file modified - linux find files modified date - unix find last modified files - linux find files by modified date - unix find files created today - find files modified in last day - unix find last modified file - unix find modified date - unix files modified today - linux find modified - find modified date - linux find today modified files - unix find creation date - linux find files modified in last hour - linux find recently changed files - linux find by date modified - unix find recently modified files - find command modified date - find modified - find latest files unix - linux find files modified recently - find files created today linux - linux find latest modified file - linux find modified date - find recently modified files linux - unix find files by date - how to find latest modified file in linux - linux find files created today - linux command to find files modified at a certain time - find last file modified unix - find recently modified files windows - linux recently modified files - unix find changed files - unix find file modified today - find mtime hours - find files changed today - find today's file in unix - find mtime today - linux find files modified in last day - find last modified files unix - find mtime 1 hour - last modified file in unix - linux find file creation date - linux find files modified last day - linux find files changed on date - find changed files linux - find files modified linux -