Skip to content

namest504/dua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DUA (Disk Usage Analyzer)

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.

Features

  • 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 -r option.
  • Adjustable Tree Depth: Allows you to set the maximum depth for the tree view using the -d option.

Installation

Prerequisites: Go (version 1.25.1 or newer is recommended).

Download Executable File

go install github.com/namest504/dua/cmd/dua@latest

Git Clone

git clone https://github.com/namest504/dua.git

Usage

Analyze the current directory

./dua

Analyze a specific directory

./dua ../../

Analyze with recursive tree view for subdirectories

./dua -r .

Analyze with a specific tree depth

./dua -r -d 3 .

Examples

Default Analysis

$ ./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
==================================================

Recursive Tree View

$ ./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
---------------------------------------

Development

If you want to run the code from the source, you can use the following methods.

Just for a run

go run ./cmd/dua/

Building and running (go build)

This method first builds an executable file and then runs it.

Build the executable

go build -o dua ./cmd/dua/

Run the built file

./dua

License This project is licensed under the MIT License.

About

dua is a command-line disk usage analyzer written in Go. It helps you quickly identify large files and directories, offering both a summary view and a recursive tree view.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages