The ctime,atime,mtime of the Linux find

Source: Internet
Author: User

In the Linux operating system, each file has a lot of time parameters, of which three are compared to the main, respectively, Ctime,atime,mtime

Atime last access time, such as LS, more etc, but chmod, chown, LS, stat, etc. will not be modified for some time, using Ls-utl can be viewed in this chronological order;
CTime the last state modification time, such as chmod, Chown and other state time changes but the modification time will not change, using stat file can be viewed;
Mtime Last content modification time, such as VI save, etc., change time changes, Atime and CTime also corresponding change

-ctime-n find files that have been modified within the current n*24h
-ctime n finds files that have been modified in the *24h (n+1) before the current n*24h
-ctime +n Find files that have been modified before (n+1) *24h

Common examples:
--Find files that were modified two days ago:
Find. -type f-mtime-2

--Find files that have been modified within 3 days:
Find-ctime-3

--delete files with a state modification time of more than 6 days in the/data/backup directory:
Find/data/backup-ctime +6-exec rm-f {} \;

--Delete the empty folder under the/data/backup directory while outputting the correct and error messages to null:
Find/data/backup-type d-empty-exec rmdir {} \; >/dev/null 2>&1

--Look for the find command that is longer than 6 days and is an empty file:
Find./-type d-empty-ctime +6

--Find files in the/home/admin directory with the modified time within 1 days
Find/home/admin-mtime-1

--Find files with the file name ". txt" in the/home/admin directory with the modified time within 1 days
Find/home/admin-name *.txt-mtime-1

The ctime,atime,mtime of the Linux find

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.