The-mtime parameter in the Find command of the Linux command

Source: Internet
Author: User
The use of this parameter for Find-mtime has more pits, which is recorded here today:

The Mtime parameter should be understood as follows:

-mtime N to find the file according to the file change time, n is an integer.

  • n indicates a file change time distance of n days
  • -N means file change time is less than n days
  • +n indicates file change time distance before n days

Cases:

  • -mtime 0 represents files that are currently 0 days away from the file modification time, which is less than 1 days (24 hours) away from the current time.
  • -mtime 1 represents a file modified from a file that is currently 1 days long, that is, 1 days (24 hours-48 hours) from the current time.
  • -mtime+1 indicates file modification time is greater than 1 days, that is, 2 days (48 hours) away from the current time file
  • -mtime-1 indicates file modification time is less than 1 days files, that is, 1 days (24 hours) from the current time

Why does-mtime+1 mean that files are modified for files greater than 1 days, that is, files that are 48 hours away from the current time, not 24 hours? Because the N value can only be an integer, that is, the nearest integer greater than 1 is 2, so-mtime+1 is not greater than the current time of 1 days (24 hours), but is greater than the current time of 2 days (48 hours).

The-mtime parameter in the Find command of the Linux command

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.