Linux systems find large file scripts

Source: Internet
Author: User

Every time you encounter a server disk full, will be very distressed, but with the following two ways to easily find the machine in the large files,

The first type: Du-sh
    • du -shThe size of the next file or directory in the current directory:
    • du -sh *Show the top 10 most space-occupying files or directories:
    • Du-s * | Sort-nr | Head

Explanation:-s option specifies that each subdirectory or file is not displayed in detail for the directory size; -H easy-to-read format displays the size of the specified directory or file

Second type: Find command (-size)

A. Find 1K files in/directory, there are three ways:

    1. Find/-size 2
    2. Find/-size 1024c
    3. Find/-size 1K

B. Find files larger than 500M in/directory

Find/-size +500m

Release: The default unit is B, and it represents 512 bytes, so 2 means 1k,1m is 2048, if you do not want to convert, you can use other units, such as C, K, M, G, the inside of the + is greater than equals, the opposite-is less than equal, using the above two methods can easily find the disk of large files, Be sure to use it flexibly.

Linux systems find large file scripts

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.