Find large files and large directory methods in Linux systems

Source: Internet
Author: User

Find large files
Eg: Find files larger than 10MB in current directory

The code is as follows:
$ find. -type f-size +10000k-exec ls-lh {} \; | awk ' {print $ ': ' $} '
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 files with a file size of less than 500b in the home directory:

The code is as follows:
$ find $HOME-size-500b
OR

The code is as follows:
$ find ~-size-500b
List the files in the root directory with a size of 512-byte blocks:

The code is as follows:
# Find/-size 20
Find a large directory under Linux
For example, sometimes disk space alarm, and you usually neglect management, monitor the growth of files, then I need to quickly understand which directories become larger, then we can use the du command to help us solve this problem.

The code is as follows:
[root@getlnx01 u03]# du-h--max-depth=1
16K./lost+found
33G./flash_recovery_area
37G./oradata
70G.
If you want to know what large folders are under the Flash_recovery_area directory, you can max-depth=2 the parameters, and if you want to sort the results, you can use the sort command. As shown below


The code is as follows:
[ROOT@GETLNX01 u03]# CD/
[root@getlnx01/]# du-hm--max-depth=2 | Sort-n
Sometimes the result of the search is too much (for example, I started the search from the root directory), has been brushing the screen, if I only want to find out the largest 12 folders, how to do? You need to use the head command to show

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.