Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does linux search based on file time

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces linux how to search according to the file time, the article is very detailed, has a certain reference value, interested friends must read it!

Search based on file time

Each file in the Linux file system has three timestamps

Access time (- atime): the last time the user accessed the file

Modification time (- mtime): the time when the content of the file was last modified.

Change time (- ctime): the time when the file metadata (metadata, such as permissions or ownership) last changed.

-atime,-mtime,-ctime is used as a time parameter in days. You can use + to indicate greater than, and-to indicate less than.

The code is as follows:

[root@localhost] # find. -type f-atime prints out the file [root@localhost ~] # find that was accessed exactly 7 days ago. -type f-mtime + print files with a modification time of more than 7 days [root@localhost ~] # find. -type f-ctime-prints files with a modification time of less than 7 days

Similar parameters include-amin (access time),-mmin (modification time), and-cmin (change time), in minutes.

Another beautiful feature of find is the-newer parameter. We can specify a parameter file for comparing timestamps, and then find all the files that are newer than the parameter file.

Find. -type f-newer file.txt

P find all files in the current directory that take longer to modify than file.txt.

The above is all the contents of the article "how linux searches based on file time". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report