dua is a simple Command-Line Interface (CLI) tool to analyze disk usage. It helps you quickly identify which files and subdirectories are consuming the most space in a given path.
- Sort by Size: Lists files and directories in descending order of their size.
- Human-Readable Format: Displays sizes in a human-friendly format (e.g.,
B,KiB,MiB,GiB). - Recursive Tree View: Provides a detailed, recursive file list for subdirectories using the
-roption. - Adjustable Tree Depth: Allows you to set the maximum depth for the tree view using the
-doption.
Prerequisites: Go (version 1.25.1 or newer is recommended).
go install github.com/namest504/dua/cmd/dua@latestgit clone https://github.com/namest504/dua.git./dua./dua ../.././dua -r ../dua -r -d 3 .$ ./dua .
Disk usage analysis for: .
==================================================
documents (D) 3.5 MiB
images (D) 600.0 KiB
src (D) 7.0 KiB
README.md 1.0 KiB
==================================================$ ./dua -r -d 2 .
---- . Internal File Size ----
├── documents 3.5 MiB
│ ├── proposal.pdf 2.0 MiB
│ └── report.docx 1.5 MiB
├── images 600.0 KiB
│ ├── background.jpg 500.0 KiB
│ └── logo.png 100.0 KiB
├── src 7.0 KiB
│ ├── main.go 5.0 KiB
│ └── utils.go 2.0 KiB
└── README.md 1.0 KiB
---------------------------------------If you want to run the code from the source, you can use the following methods.
go run ./cmd/dua/This method first builds an executable file and then runs it.
go build -o dua ./cmd/dua/./duaLicense This project is licensed under the MIT License.