LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to find a file that's modified more than 2 days ago but less than 5 days (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-a-file-thats-modified-more-than-2-days-ago-but-less-than-5-days-4175623455/)

BudiKusasi 02-09-2018 06:51 PM

How to find a file that's modified more than 2 days ago but less than 5 days
 
How to find a file that's modified more than 2 days ago but less than 5 days ago by use of any Linux utility ?

Sefyir 02-09-2018 07:25 PM

Use the find command

Code:

man find # excerpts of -mmin -mtime -type
      -mmin n
              File's data was last modified n minutes ago.
      -mtime n
              File's  data was last modified n*24 hours ago.  See the comments
              for -atime to understand how rounding affects the interpretation
              of file modification times.

      -type c
              File is of type c:

              b      block (buffered) special

              c      character (unbuffered) special

              d      directory

              p      named pipe (FIFO)

              f      regular file

              l      symbolic link; this is never true if the -L option or the
                    -follow option is in effect, unless the symbolic link  is
                    broken.  If you want to search for symbolic links when -L
                    is in effect, use -xtype.

              s      socket

              D      door (Solaris)

find operates left to right. If a result is valid for option X AND Y, it'll print it.
Because of this, if a result if valid for greater then 2 days AND less then 5 days, it should show up.

For example, find -iname \*py -iname m\* will find all files ending in py, then for those results, find files starting with m.
(You could also do m*py but misses the point)


All times are GMT -5. The time now is 12:26 PM.