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 quickly find the recently modified file in Linux

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to quickly find the recently modified files in Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

1. Use the ls command to list only today's files # ls-al-- time-style=+%D in your home folder | grep 'date +% D'

Where:-a-lists all files, including hidden files-l-enable long list format >-time-style=FORMAT- displays the time of the specified FORMAT +% D-displays or uses the date in >% m/%d/%y (month / day / year) format

Quickly find the recently modified file! Quickly find the recently modified file!

Find the most recent file in Linux

In addition, you use the can-X flag to sort the results alphabetically:

# ls-alX-- time-style=+%D | grep 'date +% D'

You can also use the-S flag to sort based on size (from large to small):

# ls-alS-- time-style=+%D | grep 'date +% directory 2. In addition, using the find command is more flexible and provides more options than ls to achieve the same purpose-the maxdepth level is used to specify the search level (subdirectory level) at the starting point of the search operation (in this case, the current directory). NewerXY is used for files whose timestamp X is newer than the timestamp Y of the reference file. X and Y denote any of the following letters:-a-access time of the reference file-B-creation time of the reference file-c-inode state change time of the reference file-m-modification time of the reference file-t-specify an absolute time directly

The following command means to find only the files modified on 2016-12-06:

# find. -maxdepth 1-newermt "2016-12-06" quickly find the recently modified file! Quickly find the recently modified file!

Find today's files in Linux

Important: use the correct date format as the reference time in the above find command. Once you use the wrong format, you will get the following error:

# find. -maxdepth 1-newermt "12-06-2016" # find: I cannot figure out how to interpret'12-06-2016' as a date or time

Or, use the following correct format:

# find. -maxdepth 1-newermt "12 Universe 06 Universe 2016" or # find. -maxdepth 1-newermt "12-06-16" quickly find the most recently modified file! Quickly find the recently modified file!

In this article, we explained how to use the ls and find commands to help list only today's files. Please use the feedback bar below to send us any questions or comments on this topic. You can also remind us of other commands that can be used for this purpose.

This is the end of this article on "how to quickly find recently modified files in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

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