Linux large file search
In this post, we will see how to list largest files or directories in linux.
-
du arguments:
-a for “all” files and directories. Leave it off for just directories
-BM to output the sizes in megabyte (M) block sizes (B)
2>/dev/null - exclude “permission denied” error messages (thanks @Oli) -
sort arguments: -n for “numeric”
-r for “reverse” (biggest to smallest) -
head arguments:
-n 50 for the just top 50 results. -
Leave off more if using a smaller number
Note: Prefix with sudo to include directories that your account does not have permission to access.
Example showing top 10 biggest files and directories in </b>/var</b> (including grand total).
####Original Posting [AskUbuntu] https://askubuntu.com/questions/36111/whats-a-command-line-way-to-find-large-files-directories-to-remove-and-free-up