DEV Community

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

Posted on

Linux tools for check disk usage and folders size

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)

Repository: https://github.com/bootandy/dust

dust

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

Site: https://dev.yorhel.nl/ncdu

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

ncdu

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

Repository: https://github.com/nachoparker/dutree

Installation: cargo install dutree

dutree

5. Pydf - df clone written with python

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

Repository: https://github.com/garabik/pydf

Install on Ubuntu/Debian: apt install pydf

Install on ArchLinux: sudo pacman -S pydf

pydf

6. Duf - Go-written better df alternative

Repository: https://github.com/muesli/duf

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

duf for path

Oldest comments (2)

Collapse
 
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

github.com/voku/dotfiles/blob/mast...

Collapse
 
tiagohmp profile image
TiagoHMP

Thanks for sharing