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 to use the find command in linux to find files according to system time

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article to share with you is about how to use the find command in linux according to the system time to find files, Xiaobian feel quite practical, so share to everyone to learn, I hope you can read this article after harvest, not much to say, follow Xiaobian to see it.

These timestamps include

mtime file contents last modified

The time at which the atime file was read or accessed

ctime file status change time

The meanings of mtime and atime are easy to understand, but ctime requires more explanation. Because the inode maintains metadata on each file, if the metadata associated with the file changes, so does the inode data. This can be caused by a series of actions, including creating symbolic links to files, changing file permissions, or moving files. Since the file contents are not read or modified in these cases, mtime and atime do not change, but ctime does.

Each of these time options needs to be combined with a value n, specified as-n, n, or +n.

The code is as follows:

N * 24

+1 means 1 * 24 +24 hours away..

+0 means 0 * 24 +24 hours away

1 means 1 * 24 + 24 to 24.

0 means 0 * 24 + 24 to 0..

-1 means 0 * 24 +24, even for future times...

1. Current time 24 hours-Current time (yesterday-today)

#find . -mtime 0

2. Current time 48 hours ago-Current time 24 hours ago (day before yesterday-yesterday)

#find . -mtime 1

3. 48 hours ago (2 days ago)

#find . -mtime +1

4. Current time 24 hours-Current time (yesterday-today)

#find . -mtime -1

The above is how to use the find command in linux to find files according to the system time. Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please 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

Servers

Wechat

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

12
Report