In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to use the find command to view recently modified files". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use the find command to view recently modified files.
The timestamp type of the file
The files in Linux have the following timestamps:
Atime: displays the time the file was last read or accessed. Amin: shows how many minutes before the file was last read or accessed mtime: displays the time the file or the program last modified the file. Mtime also changes when you change or modify the contents of a file. "modify" means to attach some data to a file and reorganize or delete some or all of it. Mmin: displays the time when the file was last modified in minutes. Ctime: displays the use of the-mtime option to show when file properties are modified
In this section, we will focus on how to use the mtime option to search for files with a timestamp within a certain range. This lists the files accessed a few days ago.
Example 1: find files in the / var/log folder that have been modified for more than 90 days.
[root@localhost ~] # find / var/log-mtime + 90-print
Where-mtime + 90 plus sign indicates greater than the following days
Example 2: find the configuration files in the / etc folder that have been modified for less than 10 days
[root@localhost] # find / etc-iname "* conf*"-mtime-10-print
Where-mtime-10 minus sign means less than the following number of days example 3: find / etc folder, the previous day modified files.
[root@localhost ~] # find / etc-mtime 1-print
Where-mtime 1 indicates this time yesterday.
The following time stamps are commonly used:
-1 Last 24 hours-0. 5 Last 12 hours-0. 25 Last 6 hours + 2 use-atime option two days ago
As mentioned earlier, atime is used to show when the user or application last accessed the file. Let's look at some examples:
Find files that have accessed the root root directory within 10 days:
[root@localhost] # find / root-atime-10-type f
To view the docx file accessed at this point 20 days ago, run the following command:
[root@localhost ~] # find / root-iname "* .docx"-atime 20-type-f using the-daystart option
The-daystart option measures the time that begins on the same day instead of 24 hours ago. For example, to find all the pdf files you edited yesterday, run:
[root@localhost ~] # find / root/data/-mtime 1-daystart-iname "* .pdf"
To list files edited 3-5 days ago, run the following command:
[root@localhost ~] # find / home/james/data/-mtime 3-mtime-5-daystart-iname "* .pdf" uses the-newer option
The-newer option compares files from two different directories and displays newer files. For example, find new files in / root/b than in / root/a:
[root@localhost ~] # find / root/b-newer / root/a here, I believe you have a better understanding of "how to use the find command to view recently modified files". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.