Linux commands to list folders with their corresponding sizes

Simple du command lists all folders with their corresponding size of disk plus to start with.
DU – Disk Usage

du

It takes given path as an argument

du ~/inimist/docs

Aggregate total of sizes of all files and folder underneath

du -s

Aggregate command works well with h option to display size in human readable format. For example, 2M, 1.3G etc.

du -sh

To sort by file or folder size

du | sort -n -r | less

To find the largest files or folders on a file system

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

List all files greater than a threshold, sorted files by size

du -h --threshold=10M | sort -h

Leave a Reply