Find recently modified file commands in Linux

Source: Internet
Author: User
Tags chmod file permissions

If there are any problems with the website or the server, you will first think about whether the file on the server has been modified, and search will use the Find command as follows:

Finds files in the current directory. php file that have been modified in the last 30 minutes.

Find. -name ' *.php '-type f-mmin-30

Find out more about the files that have been modified in the last 30 minutes in the. html file in the current directory.

Find. -name ' *.html '-type f-mmin-30-ls

Finds regular files that have been modified in the current directory for the last 1 days.

Find. -type f-mtime-1

Finds regular files that have been modified in the current directory for the last 1 days (2 days).

Find. -type F-mtime +1

If you want to look for changes to the files in the/home directory, Cd/home and then run the lookup, so it's easy to troubleshoot if you have a problem.

Find files in the/dir directory before the change time in 1st
# find dir/-type f-mtime +1

-mtime: A document that has been altered for a specified time, meaning file? Jes. br/>-ctime: A file that has been changed for a specified time, meaning that file permissions have been changed
-atime: A file that has been accessed for a specified time, meaning that the file has been read

Find the 3-day "previous" files that were changed (before the third day before →2011/09/05 12:00) (> 72 hours)
find/var/log/-mtime +3-type F-print


Find out 3 days, missing an acre?? Nigerian Fundraiser (2011/09/05 12:00 ~ 2011/09/08 12:00? (0 ~ 72 hours??)
find/var/log/-mtime-3-type F-print

Find out which documents were changed on the 3rd day (2011/09/04 12:00 ~ 2011/09/05 12:00? (72 ~ 96 hours)

find/var/log/-mtime 3-type F-print

Find out which files were changed on the 3rd day (or write them)
find/var/log/-mtime +2-mtime-4-type f-print

Add

Find files by file modification time
---(+n)----------|----------(n)----------|----------(-N)---
  (n+1) *24h before |    (n+1) *24h~n*24h    |n*24h-ctime-n    Find files modified in n*24h now
-ctime n     Find files that have been modified in the (n+1) *24h before now n*24h
-ctime +n    Find the file modified before (n+1) *24h [a|c|m]min  & nbsp [Last visit | final Status Modification | Final content modification]min
[a|c|m]time    [last visit | final state Modification | Last content modify]timelinux file three time (take find for example):
Atime last access time, such as LS, more, but chmod, chown, LS, stat, etc. will not modify some time, use 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 does not change, using stat file can be viewed;
Mtime Last content modification time, such as VI after saving, changes in time, Atime and CTime also changed accordingly. NOTE:
Linux does not record the creation time of the file, unless the file has not changed since its inception, then its creation The time of construction is the last time it was modified.
#ls-lt/home/admin   # View in modified chronological order
#ls-lut/home/admin  # View
(if you want to reverse-order, you need to add an option-R)

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.