sizes: Recursively show space (size and i-nodes) used in subdirectories

[ bsd3, development, library, program ] [ Propose Tags ] [ Report a vulnerability ]

A command-line utility that recursively analyzes directory trees to display space usage information, including both file sizes and inode counts.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0, 1.0.2, 1.1.0, 1.1.1, 1.2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.3.0, 2.3.1, 2.3.1.1, 2.3.2, 2.4.0, 2.4.1, 2.4.2, 2.4.3
Dependencies base (>=4 && <5), cmdargs (>=0.10 && <0.11), containers (>=0.5 && <0.8), deepseq (>=1.3 && <1.6), dlist (>=0.5 && <1.1), exceptions (>=0.8 && <0.11), lens (>=2.8 && <6), mtl (>=2.2 && <2.4), parallel-io (>=0.3.2 && <0.4), regex-pcre (>=0.95 && <0.96), semigroups (>=0.8 && <0.21), sizes, system-fileio (>=0.3.9 && <0.4), system-filepath (>=0.4.7 && <0.5), text (>=0.11 && <2.2), unix (>=2.5 && <2.9) [details]
License BSD-3-Clause
Author John Wiegley
Maintainer John Wiegley <johnw@newartisans.com>
Uploaded by JohnWiegley at 2026-06-29T18:04:34Z
Category Development
Home page https://github.com/jwiegley/sizes
Source repo head: git clone https://github.com/jwiegley/sizes
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables sizes
Downloads 14031 total (57 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2026-06-29 [all 1 reports]

Readme for sizes-2.4.3

[back to package description]

sizes

I wrote sizes because du wasn't giving me what I needed. When you're managing large filesystems -- especially ones with git-annex repositories -- you want to see where your disk space is actually going, sorted by size or file count, with the ability to exclude paths and handle hard-linked files properly.

It's du with a bit more flexibility: concurrent traversal, PCRE path exclusion, git-annex awareness, hard link deduplication, and output that focuses on what matters.

Getting started

# With Nix (preferred)
nix build github:jwiegley/sizes
./result/bin/sizes /path/to/dir

# Or install via Cabal
cabal install sizes

Usage

# Basic: show directories using >10MB
sizes /path/to/dir

# Sort by file count
sizes -c /path/to/dir

# Use 4 concurrent threads
sizes -j4 /path/to/dir

# Exclude paths matching a regex
sizes -x '\.cache' /path/to/dir

# Stay on one filesystem (skip mounted volumes, NFS/SMB shares, etc.)
sizes -X /path/to/dir

# Handle git-annex repos correctly
sizes -A /path/to/annex-repo

# Deduplicate hard links
sizes -L /path/to/dir

# Show apparent sizes (not allocated blocks)
sizes --apparent /path/to/dir

# Base-10 units (MB/GB instead of MiB/GiB)
sizes -H /path/to/dir

# Lower the minimum threshold
sizes -m 1 /path/to/dir

# Increase reporting depth
sizes --depth 3 /path/to/dir

# Show everything, including small entries
sizes -s /path/to/dir

Options

Flag Description
-j INT Concurrent threads (default: 2)
-c Sort by file count
-A Git-annex aware
--apparent Apparent sizes, not disk blocks
-H Base-10 (MB/GB)
-x REGEX Exclude matching paths
-m INT Minimum size in MB (default: 10)
-M INT Minimum file count (default: 100)
-B INT Block size in bytes (default: 512)
-s Show small entries
-L Deduplicate hard links
-X, --one-file-system Don't descend into other filesystems
--depth INT Reporting depth (default: 1)

Development

# Enter dev shell
nix develop

# Build
cabal build

# Run tests
cabal test

# Format code
fourmolu --mode inplace Sizes.hs app/Main.hs test/Spec.hs

# Lint
hlint Sizes.hs app/Main.hs test/Spec.hs

# Run all checks
nix flake check

License

BSD-3-Clause -- see LICENSE.md.