How to Find Big Files and Directories under Linux – Useful Commands

by Sandy

In this tutorial we’ll use the Linux command to find the location of big Files and Directories through a single command. This is useful if you didn’t found the big files or confused where to look at or there are thousands of files hosted under Linux, which creates the difficulties to find the big files quickly. As a Linux System administrator, you surely check which files and folders are eating more disk space. It is very obvious to find the junk files and free up from your server/pc disk. This commands will help you to find the big files and directories. Lets get started :

To “find” files greater than 1024k and “sort” by largest size first (my fav):
it will list 50 items grater than 1 mb (1024k)

find / -mount -size +1024k -type f -exec du -Sh {} \;|sort -rh | head -n 50

For /home dir :

find /home -mount -size +1024k -type f -exec du -Sh {} \;|sort -rh | head -n 50

To find out top biggest directories under / (root) partition.

du -a / | sort -n -r | head -n 50

To find out top biggest directories under /home partition.

du -a /home | sort -n -r | head -n 50

You can also cd (change dir) to your working dir and run this command :
To find out top biggest directories under /home partition.

du -a | sort -n -r | head -n 50

eg :

cd /home
du -a | sort -n -r | head -n 50

If this post helps you in any way please consider a donation

Donate with PayPal :

md-donate

Donate with Paytm :

md-donate

You may also like

Leave a Reply

avatar
  Subscribe  
Notify of