简体   繁体   English

Bash脚本查找过去24小时内最近修改的大文件

[英]Bash Script to find large files recently modified in the past 24 hours

How can I search through a massive amount of data (28TB) to find the largest 10 files in the past 24 hours? 如何搜索海量数据(28TB),以查找过去24小时内最大的10个文件?

From the current answers below I've tried: 从下面的当前答案中,我尝试了:

$ find . -type f -mtime -1 -printf "%p %s\\n" | sort -k2nr | head -5

This command takes over 24 hours which defeats the purpose of searching for most recently modified in the past 24 hours. 该命令耗时24小时,无法达到搜索过去24小时内最新修改的目的。 Are there any solutions known to be faster than the one above that can drastically cut search time? 是否有已知解决方案比上述解决方案更快,可以大大缩短搜索时间? Solutions to monitor the system also will not work as there is simply too much to monitor and doing such could cause performance issues. 监视系统的解决方案也将无法正常工作,因为监视太多了,这样做可能会导致性能问题。

something like this? 这样的东西?

$ find . -type f -mtime -1 -printf "%p %s\n" | sort -k2nr | head -5

top 5 modified files by size in the past 24 hours. 在过去24小时内按大小排列的前5个修改过的文件。

you can use the standard yet very powerful find command like this ( start_directory is the directory where to scan files) 您可以使用像这样的标准但功能非常强大的find命令( start_directory是扫描文件的目录)

find start_directory -type f -mtime -1 -size +3000G

-mtime -1 option: files modified 1 day before or less -size +3000G option: files of size at least 3 Gb -mtime -1选项:文件在小于或等于1天前修改-size +3000G选项:文件大小至少为3 Gb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM