Find large files Linux

#Introduction

In this tutorial, How to Find large files Linux.

Find large files Linux use find command

The find command line can use to search any files inside a Linux Filesystem.

Find the command line inside your current working directory as the command below:

find . -type f
use find command

Filter with a minimum size of 10MB

find . -type f -size +10M

To search the entire filesystem to find the largest file.

sudo find / -xdev -type f -size +10M
To search the entire filesystem to find the largest file.

Note: “-xdev flag” won’t scan other mounted filesystems in your Linux Server.

To scan all the mounted drives along with your primary filesystem

sudo find / -type f -size +10M
To scan all the mounted drives along with your primary filesystem

Find Large Unused Files: which have not been modified for more than 30 days and have a file size of at least 10MB.

sudo find / -xdev -mtime +30 -type f -size +10M
Find Large Unused Files

use du command line

the du command to estimate file sizes in Linux. And how to find large files in Linux

List the files along with directory sizes recursively

du -ah
du -ah

combined with the command sort command to sort the files in descending order. use the blocksize operator -B along with a unit of your choice. If you want to convert the sizes in MB, use unit M as a block size.

du -aBM | sort -nr
image 12

To find the largest 15 files in your entire filesystem

du / -aBM | sort -nr | head -n 15

Conclusion

You have to find large files in Linux. I hope will this your helpful. Thank you for reading the DevopsRoles page!

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.