duf — modern df
💬 "duf command"
duf is a replacement for the modern df that shows disk free space in a pretty table.
It displays usage and free space of mounted file systems. It outputs in a clean table without df's inconvenient line breaks.
- Concept: Displays usage and free space of mounted file systems.
- Main Features: Outputs in a clean table without df's inconvenient line breaks.
- Advantages: Columns align neatly.
- Use Case: Can view specific file systems only.
Installation and Download
duf can be installed via a package manager or the official script.
| Environment | Command |
|---|---|
| Ubuntu / Debian | sudo apt install duf |
| Fedora / RHEL | sudo dnf install duf |
| Arch | sudo pacman -S duf |
| macOS (brew) | brew install duf |
| Go install | go install github.com/muesli/duf@latest |
| Binary Download | github.com/muesli/duf/releases |
Verify the installation with duf --version.
Frequently Used Options
| Option | Description |
|---|---|
| --all | Displays all file systems. |
| --json | Outputs in JSON format. |
| --sort size | Sorts by size. |
| --filter | Filters specific mounts only. |
| -x tmpfs | Excludes tmpfs. |
Essential Command Combinations
duf --all— Check all mount statuses.duf --sort size— View sorted by size.duf --json | jq— Output as JSON for use in scripts.
💬 "Show me an example of using duf on an actual server"
Here is a step-by-step guide for situations commonly encountered on production servers.
Step 1 · Verify Installation
Check if it is installed.
duf --version || sudo apt install -y duf
Step 2 · Full Overview
Check all mount statuses.
duf --all
Step 3 · Check Sorting
View sorted by size.
duf --sort size
Actual Execution Output
Here is the result of checking the server's mount status with duf. The table aligns cleanly.
Production server
How It Is Used in Practice
1. Monitoring Script
Situation — Used in scripts that check disk space.
duf --json | jq -r '.[] | select(.size_bytes > 1000000000) | .mountpoint'
Result — A list of large mount points is displayed.
Key Point — JSON output is convenient for script processing.
2. Specific Mounts Only
Situation — Check only NFS mounts.
duf nfs
Result — Only NFS mount information is displayed.
Key Point — You can filter to view only the targets you need.
Actual Execution Output
This is the result sorted by size.
!duf command execution result 2
Production server
Points of Caution
- Without root permissions, duf may not be able to see some mounts.
- Inside containers, host mounts may not be visible correctly.
- Since it shows the same information as df, it can be a direct replacement in existing monitoring scripts.
- The --json output is useful when combined with jq in scripts.
Source (HTML): https://games.aidebatehub.com/programs/linux/modern/duf.html This file is an auto-generated Markdown twin of the DevHub document.
AI Knowledge Hub
Visitor Comments