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

What is the command for the Linux system to find large files?

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

Share

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

Today, I will talk to you about what is the command to find large files in the Linux system. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Everything in the Linux system is a file, in which there are a lot of large files, so how to always find large files in the Linux system?

1: how to find large files? ‎ in fact, in many cases, you need to know what large files are available on the current system, such as a file size of more than 100m or 1G (the threshold varies). So how to search out these large documents? For example, I want to search for files with a size of more than 800m in the current directory, ‎

[root@getlnx01 u03] # find. -type f-size + 800m as shown in the above command, we can only see the file names of files larger than 800m, but we know nothing about the file information (for example, file size, file attributes), so can we display some file attributes or information in more detail, of course, as shown below

[root@getlnx01 u03] # find. -type f-size + 800m-print0 | xargs-0 ls-l when we only need to find files larger than 800m and display the specific size of the found files, we can use the following command

[root@getlnx01 u03] # find. -type f-size + 800m-print0 | xargs-0 du-h if you also need to sort the search results by file size, you can use the following command

[root@getlnx01 u03] # find. -type f-size + 800m-print0 | xargs-0 du-h | sort-nr2: how to find large directories under Linux. For example, sometimes the disk space is alarming, but you are negligent in managing and monitoring the growth of files. Then I need to quickly know which directories have become larger, so we can use the du command to help us solve this problem.

[root@getlnx01 u03] # du-h-- max-depth=1 16K. / missing = find 33g. / flash_recovery_area 37G. / Oradata 70g. ‎ if you want to know which large folders are under the flash_recovery_area directory, then you can set the parameter max-depth=2, if you want to sort the search results, then you can use the sort command. ‎ as shown below

[root@getlnx01 U03] # du-h-- max-depth=2 | sort-n 3.5g. / flash_recovery_area/EPPS 16K. / missing = find 29G. / flash_recovery_area/ backup 33g. / flash_recovery_area 37G. / Oradatta 37G. / Oradatta / Epps 70g. [root@getlnx01 U03] # du-hm-- max-depth=2 | sort-n 1. / lost = found 3527. / flash_recovery_area/EPPS 29544. / flash_recovery_area/ backup 33070. / flash_recovery_area 37705. / Oradatta 37705. / Oradatta / Epps 70775. [root@getlnx01 u03] # cd / [root@getlnx01 /] # du-hm-- max-depth=2 | sort-n ‎ sometimes has too many search results (for example, I search from the root directory) and has been brushing the screen all the time. What if I only want to find the largest 12 folders? At this point, ‎ is displayed with the help of the head command.

[root@getlnx01 /] # du-hm-- max-depth=2 | sort-nr | head-12 407480. 167880. / u04 158685. / u02 158685. / u04 152118. / u04 / Oradata 70775. / u03 37705. / U03 / Aoladata 33070. / u03/flash_recovery_area 5995. / u01 / application 5995. / U01 3551. / usr 1558. / USD / share after reading the above, do you have any further understanding of what is the order for the Linux system to find large files? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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