MCPcopy Index your code
hub / github.com/KSXGitHub/parallel-disk-usage

github.com/KSXGitHub/parallel-disk-usage @0.24.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.24.0 ↗ · + Follow
574 symbols 1,397 edges 127 files 104 documented · 18%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Parallel Disk Usage (pdu)

Test Benchmark Clippy Code formatting Crates.io Version

Highly parallelized, blazing fast directory tree analyzer.

Description

pdu is a CLI program that renders a graphical chart for disk usages of files and directories, it is an alternative to dust and dutree.

Benchmark

The benchmark was generated by a GitHub Workflow and uploaded to the release page.

Programs

benchmark results (lower is better)

(See more)

Demo

screenshot

asciicast of pdu command

asciicast of pdu command on /usr

Features

  • Very fast.
  • Relative comparison of separate files.
  • Extensible via the library crate or JSON interface.
  • Unbiased regarding hardlinks: All hardlinks are treated as equally real.
  • Optional hardlink detection and deduplication (would make pdu proportionally slower).
  • Optional progress report (would make pdu slightly slower).
  • Customize tree depth.
  • Customize chart size.

Limitations

  • Ignorant of reflinks (from COW filesystems such as BTRFS and ZFS).
  • Does not follow symbolic links.
  • The runtime is optimized at the expense of binary size.

Usage

See USAGE.md for the full help text.

Development

Prerequisites

Test

./test.sh && ./test.sh --release

Environment Variables

name type default value description
FMT true or false true Whether to run cargo fmt
LINT true or false true Whether to run cargo clippy
DOC true or false false Whether to run cargo doc
BUILD true or false true Whether to run cargo build
TEST true or false true Whether to run cargo test
BUILD_FLAGS string (empty) Space-separated list of flags for cargo build
TEST_FLAGS string (empty) Space-separated list of flags for cargo test
TEST_SKIP string (empty) Space-separated list of test names to skip

Run

./run pdu "${arguments[@]}"
  • "${arguments[@]}": List of arguments to pass to pdu.

Build

Debug build

cargo build --bin pdu

The resulting executable is located at target/debug/pdu.

Release build

cargo build --bin pdu --release

The resulting executable is located at target/release/pdu.

Update shell completion files

./generate-completions.sh

Extending parallel-disk-usage

The parallel-disk-usage crate is both a binary crate and a library crate. If you desire features that pdu itself lacks (that is, after you have asked the maintainer(s) of pdu for the features but they refused), you may use the library crate to build a tool of your own. The documentation for the library crate can be found in docs.rs.

Alternatively, the pdu command provides --json-input flag and --json-output flag. The --json-output flag converts disk usage data into JSON and the --json-input flag turns said JSON into visualization. These 2 flags allow integration with other CLI tools (via pipe, as per the UNIX philosophy).

Beware that the structure of the JSON tree differs depending on the number of file/directory names that were provided (as CLI arguments): * If there are only 0 or 1 file/directory names, the name of the tree root would be a real path (either . or the provided name). * If there are 2 or more file/directory names, the name of the tree root would be (total) (which is not a real path), and the provided names would correspond to the children of the tree root.

Installation

Any Desktop OS

From GitHub

Go to the GitHub Release Page and download a binary.

[!NOTE] Starting with version 0.23.0, every executable published to GitHub Releases ships with a build provenance attestation, so you can cryptographically verify that the binary was produced by this repository's deployment workflow rather than uploaded by hand. See How can I trust the release binaries? for the verification command.

From crates.io

Prerequisites: * cargo

cargo install parallel-disk-usage --bin pdu

Arch Linux

From the Official Repository

sudo pacman -S parallel-disk-usage

Distributions

Packaging Status

Frequently Asked Questions

Is this project vibe-coded?

No. "Vibe coding" means letting AI do everything without human involvement. This project uses AI-assisted workflows with active human direction and reviews.

Using AI also does not mean poor quality. On the contrary, AI reviews have helped detect previously undetected bugs.

How can I trust the release binaries?

Starting with version 0.23.0, every executable published to GitHub Releases is accompanied by a build provenance attestation. The attestation is cryptographically signed by Sigstore and records that the binary was built by this repository's GitHub Actions deployment workflow from a specific commit. Sigstore is a public-good signing service operated by the Linux Foundation. The signing happens inside GitHub's infrastructure via OIDC, and the signatures are logged to Sigstore's public transparency log. The guarantee therefore does not depend on trusting the maintainer's personal word. Any tampered or manually uploaded binary would fail verification.

To verify a downloaded binary, install the GitHub CLI and run:

gh attestation verify downloaded-pdu --repo KSXGitHub/parallel-disk-usage
# note: replace `downloaded-pdu` with the filename you downloaded.

A successful run prints the signer workflow and confirms that the file's SHA-256 matches the attested digest. All attestations for this repository can also be browsed at the Attestations page.

Binaries from releases older than 0.23.0 are not attested.

Similar programs

License

Apache 2.0 © Hoàng Văn Khải.

Extension points exported contracts — how you extend this code

SummarizeHardlinks (Interface)
Ability to summarize into a [`Summary`]. [7 implementers]
src/hardlink/hardlink_list/summary.rs
FsApi (Interface)
Mockable interface to filesystem operations. Abstracts system calls like [`canonicalize`], [`Path::exists`], and [`std: [5 …
src/app/hdd.rs
GetSize (Interface)
Infers size from a [`Metadata`]. [3 implementers]
src/get_size.rs
Reporter (Interface)
Report progress. [3 implementers]
src/reporter.rs
GetSizeUtils (Interface)
(no doc) [3 implementers]
src/app.rs
Size (Interface)
Types whose values can be used as disk usage statistic.
src/size.rs
Item (Interface)
(no doc)
ci/github-actions/benchmark/collect-regressions.ts
DeduplicateSharedSize (Interface)
Ability to correct the sizes in a [`DataTree`] by reducing the size of recorded shared links. The input tree is assumed [2 …
src/hardlink/deduplicate.rs

Core symbols most depended-on inside this repo

iter
called by 64
src/hardlink/hardlink_list/iter.rs
size
called by 56
src/data_tree/getters.rs
as_ref
called by 29
src/os_string_display.rs
clone
called by 28
src/visualizer/copy.rs
into_reflection
called by 27
src/hardlink/hardlink_list.rs
len
called by 26
src/hardlink/hardlink_list.rs
is_empty
called by 24
src/hardlink/hardlink_list.rs
par_cull_insignificant_data
called by 21
src/data_tree/retain.rs

Shape

Function 234
Method 204
Class 84
Enum 27
Interface 25

Languages

Rust94%
TypeScript6%

Modules by API surface

tests/_utils.rs24 symbols
src/man_page.rs21 symbols
tests/usual_cli.rs19 symbols
src/app/hdd.rs17 symbols
src/usage_md.rs13 symbols
src/app.rs13 symbols
src/hardlink/hardlink_list/reflection.rs12 symbols
src/app/overlapping_arguments/test_remove_overlapping_paths.rs12 symbols
src/visualizer/tree.rs11 symbols
src/hardlink/hardlink_list.rs11 symbols
src/app/hdd/test.rs11 symbols
ci/github-actions/benchmark/report-files.ts11 symbols

For agents

$ claude mcp add parallel-disk-usage \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact