In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to find all the large files in the directory under CentOS". The content in the article is simple and clear, and it is easy to learn and understand. Please follow Xiaobian's train of thought to study and learn "how to find all the large files in the directory under CentOS".
q. How do I find all the large files in the directory?
a.
1) syntactic for RedHat / CentOS / Fedora Linux
Find {/ path/to/directory/}-type f-size + {size-in-kb} k-exec ls-lh {}\; | awk'{print $9 ":" $5}'
Example:
Find files greater than 50MB in the current directory
$find. -type f-size + 5000k-exec ls-lh {}\; | awk'{print $9 ":" $5} "
Find files whose directory / var/log is greater than 100MB
# find / var/log-type f-size + 100000k-exec ls-lh {}\; | awk'{print $9 ":" $5}'
2) syntactic for Debian / Ubuntu Linux
Find {/ path/to/directory}-type f-size + {file-size-in-kb} k-exec ls-lh {}\; | awk'{print $8 ":" $5}'
Example:
Find files greater than 10MB in the current directory
$find. -type f-size + 10000k-exec ls-lh {}\; | awk'{print $8 ":" $5}'
Sample output:
. / .kde / share/apps/akregator/Archive/http___blogs.msdn.com_MainFeed.aspx?Type=AllBlogs.mk4: 91M
. / out/out.tar.gz: 828M
. /. Cache/tracker/file-meta.db: 101M
. / ubuntu-8.04-desktop-i386.iso: 700M
. / vivek/out/mp3/Eric: 230M
List the files with a file size less than 500b in the home directory:
$find $HOME-size-500b
OR
$find ~-size-500b
List the files with a size of 20 512-byte blocks in the root directory:
# find /-size 20
Perl tip: display large files
Displays the occupancy of each directory under the current directory according to the file size from small to large (note: asterisk and asterisk length)
Du-k | sort-n | perl-ne'if (/ ^ (\ d +)\ s + (. * $) /) {$l=log ($1mm.1); $m=int ($l/log (1024)); printf ("% 6.1f\ t% s\ t% 25s% s\ n", ($1 / (2cm * (10cm), (("K", "M", "G", "T", "P") [$m]), "*" x (1.5cm), $2);}'
Ls command: find the largest file in the directory
You can also use the ls command:
$ls-lS
$ls-lS | less
$ls-lS | head + 10
Ls command: find the smallest file in the directory
As follows:
$ls-lSr
$ls-lSr | less
$ls-lSr | tail-10
Other lessons for you:
Find. -xdev-printf'% s% p\ n' | sort-nr | head-20
Du-xak. | sort-n | tail-50
Thank you for your reading, the above is the content of "how to find all large files in the directory under CentOS". After the study of this article, I believe you have a deeper understanding of how to find all large files in the directory under CentOS. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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: 280
*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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.