Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use the find command in linux to find files according to system time

Shulou Source: shulou.com Published: 2022-06-01 22:12:46 10月17日 Update

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.

Tags: Time files hours changes data more commands systems between content knowledge articles relevant practical code meaning that is work meetings situations articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Technology Microsoft Huawei Xiaomi