Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
dutree – A CLI Tool to Analyze Disk Usage in Coloured Output
The dutree is an open-source command line tool for Linux that analyzes disk usage and displays output in a colorful, tree-like format. This tool combines the functionality of du (disk usage) and tree (directory structure) commands, written in the Rust programming language. It helps identify which directories and files consume the most disk space, making it easier to manage storage and free up space when needed.
Unlike traditional disk usage tools that display plain text output, dutree provides visual hierarchy with color coding, making it easier to quickly identify large files and directories at a glance.
Installation
Since dutree is written in Rust, you need to install Rust and Cargo first. Install Rust using the official installer:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
After installing Rust, install dutree directly from its GitHub repository:
cargo install --git https://github.com/nachoparker/dutree.git
Note: Ensure your system has git, cargo, and curl utilities installed before proceeding.
Basic Usage
dutree uses the LS_COLORS environment variable to display colored output, similar to ls --color. Run dutree without arguments to display the filesystem tree for the current directory:
dutree
To see actual disk usage instead of file sizes, use the -u parameter:
dutree -u
By default, dutree displays sizes in kilobytes. Use -b to display results in bytes:
dutree -b
Key Options
Display Control
Disable colors and use only ASCII characters:
dutree -A
Show all files including small ones (default threshold is 1MB):
dutree -a
Display full summary overview:
dutree -s
Filtering Options
Exclude hidden files from analysis:
dutree -H
Exclude specific files or directories:
dutree -x filename_or_directory
Show files only (exclude subdirectories):
dutree -f
Depth Control
Limit directory traversal to a specific depth (default is 1):
dutree -d 3
Common Options Reference
| Option | Description |
|---|---|
-u |
Show actual disk usage instead of file size |
-b |
Display sizes in bytes instead of kilobytes |
-A |
Use ASCII characters only, disable colors |
-H |
Exclude hidden files from analysis |
-a |
Show all files including small ones |
-x |
Exclude specific files or directories |
-f |
Show files only, exclude subdirectories |
-s |
Display full summary overview |
-d N |
Limit directory depth to N levels |
Conclusion
dutree is a powerful disk usage analysis tool that combines visual appeal with practical functionality. Its colored, tree-like output makes it easy to identify space-consuming files and directories quickly. With options for filtering, depth control, and various display formats, dutree provides an efficient way to manage disk space in Linux systems.
