• notice
  • Congratulations on the launch of the Sought Tech site

Linux system find large files script

Every time the server disk is full, it will be very distressing, but with the following two methods, you can easily find the large files in the machine,

The first: du -sh

  • du -sh The size of the next file or directory in the current directory:

  • du -sh * Display the top 10 files or directories that take up the most space:

  • du -s * | sort -nr | head

Explanation: The -s option specifies that the size of each subdirectory or file is not displayed in detail for the directory; -h has an easy-to-read format to display the size of the specified directory or file

The second: find command (-size)

a. There are three ways to find 1K files in the / directory:

  1. find / -size 2

  2. find / -size 1024c

  3. find / -size 1K

b. Find files larger than 500M in the / directory

find / -size +500M

Explanation: The default unit is b, and it represents 512 bytes, so 2 means 1K, and 1M means 2048. If you don’t want to convert it yourself, you can use other units, such as c, K, M, G; the + in it is greater than Equal to, on the contrary - is less than or equal to, using the above two methods can easily find large files in the disk, must be used flexibly.


Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

atorvastatin price & lt;a href="https://lipiws.top/"& gt;atorvastatin 40mg pill& lt;/a& gt; oral atorvastatin

Oudeip

2024-03-07

Leave a Reply

+