The "Find" command is used together with the date statement in atime/ctime/mtime.

Source: Internet
Author: User
Tags touch command
When the Find command is used with atime/ctime/mtime, find is a frequently used Maintenance Command on aix/linux, but time-based search is often used. This article mainly introduces the parameters for finding with atime, ctime, and mtime. Www.2cto. comati... when the Find command is used with atime/ctime/mtime, find is a frequently used Maintenance Command on aix/linux, but time-based search is often used. This article mainly introduces the parameters for finding with atime, ctime, and mtime. Www.2cto.com atime: access time refers to the last time when the file is read. you can use the touch command to change it to the current time. ctime: change time ), indicates the time when the file is last changed. The change action can enable chmod, chgrp, and mv. mtime: modify time ), it refers to the last modification time of the file content. the modification action can redirect echo and vi. the following example should be easy to understand the above three times: a user at 00:00:00 on January 1, January 5, 2013, enter ping www.baidu.com> ping under/home. log; 5 seconds later, the user uses ctrl + C to force the command to close; 5 seconds later, use cat ping. view logs. The ctime of ping. log is 00:00:00, the mtime is 00:00:05, and the atime is 00:00:10. After understanding these three parameters, we can use find to find a collection of objects that have performed certain operations at a certain time point. Find. {-atime/-ctime/-mtime/-amin/-cmin/-mmin} [-/+] num first parameter ,., indicates the current directory. if it is another directory, you can enter the absolute directory and relative directory location. The second parameter is divided into two parts. The first letters a, c, and m represent access, change, and modify, respectively, the following time is the date and min is the minute. Note that only these two parameters can be used as the unit. The third parameter is the amount, and the value does not contain symbols, "With-" indicates that the value is equal to the specified quantity, and "with +" indicates that the value is equal to the previous value. Note: in the find statement, the time is calculated as follows: 1 ...... so far, with the + number, from ...... start with "-", indicating that a time unit is not signed; 2. a number indicates the forward offset; 3. a time unit from the current to the next is the benchmark 0; and "-0" indicates the lower limit unit; + 0 indicates the upper limit unit. Assume that the current time is 00:00:00, January 1, January 5, 2013. 1. search for the files that have been accessed from 00:00:00, January 1, January 5, 2013 to 23:59:59, January 1, January 5, 2013. the time unit is day and the time unit is unsigned, there is no forward offset currently, so the query statement is: find. -atime 0 2. search for files modified from 23:50:00, January 1, January 4, 2013 to 23:55:00, January 1, January 4, 2013: The time unit is min, the minimum offset is 10 min from the current forward offset, and the maximum offset is 5 min from the current forward offset, therefore, the query statement is find. -mmin-10-mmin + 5
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.