DEV Community

Cover image for Linux tools for check disk usage and folders size

Linux tools for check disk usage and folders size

insolita profile image Insolita ・2 min read

1. Native ones

du - Summarize disk usage of the set of FILEs, recursively for directories.

Most popular commands:
du -sh /path - show total summary for a defined path

du -h -d 1 /path - show directory sizes with custom depth (-d option)

du -h -d 1 /path | sort -hr - same as previous, but with sort from largest to lowest

du output

df - report file system disk space usage

Output result looks like:
df output

2. Dust - Rust-written du improve.

Show result as a pretty tree with sort (Ascending by default)



Output can be limited by depth and reversed from largest to lowest

dust -r -d 1

dust -r -d1

Also, it has an interesting feature - showing by file count instead of files size

dust -fr

3. Ncdu - N-curses du version


Install on Ubuntu: apt install ncdu

Install on ArchLinux: sudo pacman -S ncdu

It scans the defined directory, show disk usage, and bring the ability to navigate by child directories


4. Dutree - yet another du alternative, written with rust


Installation: cargo install dutree


5. Pydf - df clone written with python

Behavior is similar to native df, but with more pretty colorized output


Install on Ubuntu/Debian: apt install pydf

Install on ArchLinux: sudo pacman -S pydf


6. Duf - Go-written better df alternative


Install on Ubuntu/Debian: apt install duf

Install on ArchLinux: yay -S duf

It is really fast, has a pretty look, and has a killer feature - the ability to output as JSON, that can be useful for monitoring


duf for path

Discussion (1)

Editor guide
suckup_de profile image
Lars Moelleken

Some years ago, I added this little helper in my .dotfiles :)

# show the biggest files in a folder first
alias du_overview='du -h | grep "^[0-9,]*[MG]" | sort -hr | less'
Enter fullscreen mode Exit fullscreen mode