Learn how to – Check Disk Usage on Linux / macOS with duf.
Getting your storage devices usage information is a perennial operation of any Desktop / Server user. duf is a command line tool created to enable Linux, macOS and BSD users print Disk Usage in their terminal console. This tool aims at unifying commands required to output disk usage, getting inodes info, filesystem, mountpoint, type e.t.c. This article will walk you through the installation and usage of duf utility.
Features of duf tool
- It has a colorful and user-friendly output
- You can sort the results according to your needs
- Ability to adjust the output to your terminal’s width
- Groups & filters devices
- You can output in JSON format for use with other tools
Install duf on Linux
There are many ways of installing duf utility in a Linux machine.
Install using binary method
Download the latest binary file for a Linux machine.
curl -s https://api.github.com/repos/muesli/duf/releases/latest | grep browser_download_url | grep linux_x86_64.tar.gz | cut -d '"' -f 4 | wget -i -
Extract downloaded archive.
tar xvf duf_*_linux_x86_64.tar.gz
Give the binary file executable bit.
chmod a+x duf
Move the binary file to /usr/local/bin directory.
sudo mv duf /usr/local/bin
Test if the file is executable:
$ duf
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 2 local devices │
├────────────┬───────┬──────┬───────┬───────────────────────────────┬──────┬────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────┼───────┼──────┼───────┼───────────────────────────────┼──────┼────────────┤
│ / │ 37.4G │ 2.9G │ 32.9G │ [#...................] 7.8% │ ext4 │ /dev/sda1 │
│ /boot/efi │ 60.0M │ 2.5M │ 57.5M │ [....................] 4.2% │ vfat │ /dev/sda15 │
╰────────────┴───────┴──────┴───────┴───────────────────────────────┴──────┴────────────╯
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 6 special devices │
├────────────────┬────────┬────────┬────────┬───────────────────────────────┬──────────┬────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────────┼────────┼────────┼────────┼───────────────────────────────┼──────────┼────────────┤
│ /dev │ 1.9G │ 0B │ 1.9G │ │ devtmpfs │ udev │
│ /dev/shm │ 1.9G │ 8.0K │ 1.9G │ [....................] 0.0% │ tmpfs │ tmpfs │
│ /run │ 384.0M │ 832.0K │ 383.2M │ [....................] 0.2% │ tmpfs │ tmpfs │
│ /run/lock │ 5.0M │ 0B │ 5.0M │ │ tmpfs │ tmpfs │
│ /run/user/0 │ 384.0M │ 0B │ 384.0M │ │ tmpfs │ tmpfs │
│ /sys/fs/cgroup │ 1.9G │ 0B │ 1.9G │ │ tmpfs │ tmpfs │
╰────────────────┴────────┴────────┴────────┴───────────────────────────────┴──────────┴────────────╯
Install using packages
The package installation is an alternative method.
Arch Linux / Manjaro:
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -S duf
Ubuntu / Debian:
curl -s https://api.github.com/repos/muesli/duf/releases/latest | grep browser_download_url | grep linux_amd64.deb | cut -d '"' -f 4 | wget -i -
sudo dpkg -i duf_*_linux_amd64.deb
CentOS / RHEL / Fedora:
curl -s https://api.github.com/repos/muesli/duf/releases/latest | grep browser_download_url | grep linux_amd64.rpm | cut -d '"' -f 4 | wget -i -
sudo rpm -Uvh duf_*_linux_amd64.rpm
Install duf on macOS
For macOS users installation can be done with Homebrew or MacPorts.
But you’ll need to install Homebrew or MacPorts depending on the method you want to use.
### Install Homebrew on macOS ###
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
You can check MacPorts installation guide for how to steps. The following commands are used to install duf on macOS using brew.
$ brew install muesli/tap/duf
==> Tapping muesli/tap
Cloning into '/usr/local/Homebrew/Library/Taps/muesli/homebrew-tap'...
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 21 (delta 7), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (21/21), done.
Tapped 4 formulae (48 files, 31.6KB).
==> Installing duf from muesli/tap
==> Downloading https://github.com/muesli/duf/releases/download/v0.3.1/duf_0.3.1_Darwin_x86_64.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/297165998/52bd4f80-ffc5-11ea-9431-de9ad9d69000?X-Amz-Algorithm=AWS4-HMAC-SHA2
######################################################################## 100.0%
/usr/local/Cellar/duf/0.3.1: 5 files, 2.5MB, built in 4 seconds
For installation using MacPorts here are the commands you’ll use.
$ sudo port selfupdate
$ sudo port install duf
Using duf command to check disk usage on Linux | macOS
The basic command usage is:
$ duf
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 4 local devices │
├────────────────────────┬────────┬────────┬────────┬───────────────────────────────┬──────┬──────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────────────────┼────────┼────────┼────────┼───────────────────────────────┼──────┼──────────────┤
│ / │ 931.5G │ 10.5G │ 391.7G │ [....................] 1.1% │ apfs │ /dev/disk1s1 │
│ /System/Volumes/Data │ 931.5G │ 524.9G │ 391.7G │ [###########.........] 56.3% │ apfs │ /dev/disk1s2 │
│ /Volumes/VMware Fusion │ 1.2G │ 1.2G │ 80.0M │ [##################..] 93.7% │ hfs │ /dev/disk2s1 │
│ /private/var/vm │ 931.5G │ 3.7G │ 391.7G │ [....................] 0.4% │ apfs │ /dev/disk1s5 │
╰────────────────────────┴────────┴────────┴────────┴───────────────────────────────┴──────┴──────────────╯
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 1 special device │
├────────────┬────────┬────────┬───────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────┼────────┼────────┼───────┼───────────────────────────────┼───────┼────────────┤
│ /dev │ 347.5K │ 347.5K │ 0B │ [####################] 100.0% │ devfs │ devfs │
╰────────────┴────────┴────────┴───────┴───────────────────────────────┴───────┴────────────╯
Display the output while sorted by size.
$ duf --sort size
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 4 local devices │
├────────────────────────┬────────┬────────┬────────┬───────────────────────────────┬──────┬──────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────────────────┼────────┼────────┼────────┼───────────────────────────────┼──────┼──────────────┤
│ /Volumes/VMware Fusion │ 1.2G │ 1.2G │ 80.0M │ [##################..] 93.7% │ hfs │ /dev/disk2s1 │
│ / │ 931.5G │ 10.5G │ 391.7G │ [....................] 1.1% │ apfs │ /dev/disk1s1 │
│ /System/Volumes/Data │ 931.5G │ 524.9G │ 391.7G │ [###########.........] 56.3% │ apfs │ /dev/disk1s2 │
│ /private/var/vm │ 931.5G │ 3.7G │ 391.7G │ [....................] 0.4% │ apfs │ /dev/disk1s5 │
╰────────────────────────┴────────┴────────┴────────┴───────────────────────────────┴──────┴──────────────╯
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 1 special device │
├────────────┬────────┬────────┬───────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────┼────────┼────────┼───────┼───────────────────────────────┼───────┼────────────┤
│ /dev │ 347.5K │ 347.5K │ 0B │ [####################] 100.0% │ devfs │ devfs │
╰────────────┴────────┴────────┴───────┴───────────────────────────────┴───────┴────────────╯
List inode information instead of block usage:
$ duf --inodes
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 4 local devices │
├────────────────────────┬────────────┬─────────┬────────────┬───────────────────────────────┬──────┬──────────────┤
│ MOUNTED ON │ INODES │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────────────────┼────────────┼─────────┼────────────┼───────────────────────────────┼──────┼──────────────┤
│ / │ 9767978160 │ 488397 │ 9767489763 │ [....................] 0.0% │ apfs │ /dev/disk1s1 │
│ /System/Volumes/Data │ 9767978160 │ 1942488 │ 9766035672 │ [....................] 0.0% │ apfs │ /dev/disk1s2 │
│ /Volumes/VMware Fusion │ 4294967279 │ 4529 │ 4294962750 │ [....................] 0.0% │ hfs │ /dev/disk2s1 │
│ /private/var/vm │ 9767978160 │ 3 │ 9767978157 │ [....................] 0.0% │ apfs │ /dev/disk1s5 │
╰────────────────────────┴────────────┴─────────┴────────────┴───────────────────────────────┴──────┴──────────────╯
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 1 special device │
├────────────┬────────┬──────┬───────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON │ INODES │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────┼────────┼──────┼───────┼───────────────────────────────┼───────┼────────────┤
│ /dev │ 1215 │ 1215 │ 0 │ [####################] 100.0% │ devfs │ devfs │
╰────────────┴────────┴──────┴───────┴───────────────────────────────┴───────┴────────────╯
List everything (including pseudo, duplicate, inaccessible file systems):
$ duf --all
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 4 local devices │
├────────────────────────┬────────┬────────┬────────┬───────────────────────────────┬──────┬──────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────────────────┼────────┼────────┼────────┼───────────────────────────────┼──────┼──────────────┤
│ / │ 931.5G │ 10.5G │ 391.7G │ [....................] 1.1% │ apfs │ /dev/disk1s1 │
│ /System/Volumes/Data │ 931.5G │ 524.9G │ 391.7G │ [###########.........] 56.3% │ apfs │ /dev/disk1s2 │
│ /Volumes/VMware Fusion │ 1.2G │ 1.2G │ 80.0M │ [##################..] 93.7% │ hfs │ /dev/disk2s1 │
│ /private/var/vm │ 931.5G │ 3.7G │ 391.7G │ [....................] 0.4% │ apfs │ /dev/disk1s5 │
╰────────────────────────┴────────┴────────┴────────┴───────────────────────────────┴──────┴──────────────╯
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 1 special device │
├────────────┬────────┬────────┬───────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────┼────────┼────────┼───────┼───────────────────────────────┼───────┼────────────┤
│ /dev │ 347.5K │ 347.5K │ 0B │ [####################] 100.0% │ devfs │ devfs │
╰────────────┴────────┴────────┴───────┴───────────────────────────────┴───────┴────────────╯
Sort by used capacity.
$ duf --sort used
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 4 local devices │
├────────────────────────┬────────┬────────┬────────┬───────────────────────────────┬──────┬──────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────────────────┼────────┼────────┼────────┼───────────────────────────────┼──────┼──────────────┤
│ /Volumes/VMware Fusion │ 1.2G │ 1.2G │ 80.0M │ [##################..] 93.7% │ hfs │ /dev/disk2s1 │
│ /private/var/vm │ 931.5G │ 3.7G │ 391.7G │ [....................] 0.4% │ apfs │ /dev/disk1s5 │
│ / │ 931.5G │ 10.5G │ 391.7G │ [....................] 1.1% │ apfs │ /dev/disk1s1 │
│ /System/Volumes/Data │ 931.5G │ 524.9G │ 391.7G │ [###########.........] 56.3% │ apfs │ /dev/disk1s2 │
╰────────────────────────┴────────┴────────┴────────┴───────────────────────────────┴──────┴──────────────╯
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 1 special device │
├────────────┬────────┬────────┬───────┬───────────────────────────────┬───────┬────────────┤
│ MOUNTED ON │ SIZE │ USED │ AVAIL │ USE% │ TYPE │ FILESYSTEM │
├────────────┼────────┼────────┼───────┼───────────────────────────────┼───────┼────────────┤
│ /dev │ 347.5K │ 347.5K │ 0B │ [####################] 100.0% │ devfs │ devfs │
╰────────────┴────────┴────────┴───────┴───────────────────────────────┴───────┴────────────╯
Valid keys for sorting are:
- size
- used
- avail
- usage
- inodes
- inodes_used
- inodes_avail
- inodes_usage
- type
- filesystem
- mountpoint
Here is an another example with some columns hidden in the output:
$ duf --output mountpoint,size,usage,avail
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 4 local devices │
├────────────────────────┬────────┬────────┬───────────────────────────────┤
│ MOUNTED ON │ SIZE │ AVAIL │ USE% │
├────────────────────────┼────────┼────────┼───────────────────────────────┤
│ / │ 931.5G │ 391.7G │ [....................] 1.1% │
│ /System/Volumes/Data │ 931.5G │ 391.7G │ [###########.........] 56.3% │
│ /Volumes/VMware Fusion │ 1.2G │ 80.0M │ [##################..] 93.7% │
│ /private/var/vm │ 931.5G │ 391.7G │ [....................] 0.4% │
╰────────────────────────┴────────┴────────┴───────────────────────────────╯
â•â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â•®
│ 1 special device │
├────────────┬────────┬───────┬───────────────────────────────┤
│ MOUNTED ON │ SIZE │ AVAIL │ USE% │
├────────────┼────────┼───────┼───────────────────────────────┤
│ /dev │ 347.5K │ 0B │ [####################] 100.0% │
╰────────────┴────────┴───────┴───────────────────────────────╯
You can also print output in json format by using –json command option.
$ duf --json
Check similar guides available on our website.
- Install wtfutil Personal Information Dashboard for your terminal
- Top Terminal Based Monitoring Tools for Linux
- Install Bashtop – Terminal Resource Monitor for Linux | macOS | FreeBSD
- How To Copy and Paste Text Content from Linux Terminal
Leave a Reply
You must be logged in to post a comment.