Find command -- find files modified within a specified time period. for example, if we want to find files modified within a specified time period in linux, we can use the find command. In fact, the find command is very powerful, below we use a few simple examples to learn the simple usage of the find command: find/opt-iname "*"-atime1-typef find/opt the file option accessed next day all
Find command -- to find the modified files within the specified time
For example, if we want to find files that have been modified within a specified period of time in linux, we can use the find command. In fact, the find command is very powerful, here are a few simple examples to learn the simple usage of the find command:
Find/opt-iname "*"-atime 1-type f
Find the files accessed by/opt the next day
OPTIONS
All options always return true values, and they will always be executed unless they are placed in a place that cannot be executed in the expression. Therefore, to be clear, it is best to place them at the beginning of the expression.
-Daystart
Calculate the time (for-amin,-atime,-cmin,-ctime,-mmin, and-mtime) from the start time of the day instead of before 24 hours ).
-Amin n
The last access to the file was n minutes ago.
-Anewer file
The last access to the file is later than the modification time of the file. If-follow in the command line is earlier than-anewer, (and only in this case-anewer will be affected by-follow ).
-Atime n
The last access to the file was n * 24 hours ago.
-Cmin n
The last modification to the file status was n minutes ago.
-Cnewer file
The last modification to the file status is later than the modification time of the file. If-follow in the command line is earlier than-cnewer, (and only in this case-cnewer will be affected by-follow ).
-Ctime n
The last modification to the file status was made n * 24 hours ago.
-Mmin n
The last modification to the file data was made n minutes ago.
-Mtime n
The last modification to the file data was made n * 24 hours ago.
-Mtime: indicates the object that has been modified at the specified time? Hot failover? Tomb
-Ctime: specifies the time when the file has been changed. This indicates that the file permission has been changed.
-Atime: A file that has been accessed at a specified time, meaning that the file has been read.
1. the time is in the unit of 24 hours instead of the day.
2. can I start searching for a day at a.m. on February 1? Magpie mould? 1/09/07 ~ ? Que nai? /Span>
Find the files Modified 3 days ago (files earlier than the third day before) (> 72 hours)
find /var/log/ -mtime +3 -type f -print
3 days? Missing mu ?? Nead ~ 2011/09/08? 00? Que nai? (0 ~ 72 hours ??
find /var/log/ -mtime -3 -type f -print
Find the files modified in the previous 3rd days ~ ? Que nai? (72 ~ 96 hours)
find /var/log/ -mtime 3 -type f -print
Find the file that has been modified in the last day (you can also write it like this)
find /var/log/ -mtime +2 -mtime -4 -type f -print