Disk space analyzer with terminal visualizations
cargo install spacemap
Download pre-built binaries from Releases.
git clone https://github.com/chris-alexiuk/spacemap
cd spacemap
cargo build --release
# Scan current directory
spacemap
# Scan specific path
spacemap /path/to/directory
# Show top 20 largest files and directories
spacemap --verbose --top 20
# Get help
spacemap --help
spacemap can categorize files in three different ways:
spacemap --by type
Groups files by extension into categories like Images, Videos, Code, etc.
spacemap --by size
Groups files into size buckets (0-1 KiB, 1-10 KiB, etc.).
spacemap --by age
Groups files by last modification time (0-7 days, 7-30 days, etc.).
| Option | Description |
|---|---|
--by <MODE> |
Categorization mode: type, size, or age |
-v, --verbose |
Show top N files and directories |
--top <N> |
Number of top items to show (default: 10) |
--max-depth <N> |
Maximum recursion depth |
--exclude <PATTERN> |
Exclude paths containing pattern |
--follow-symlinks |
Follow symbolic links |
--no-color |
Disable colored output |
--json |
Output JSON to stdout |
--output <FILE> |
Write JSON output to file |
spacemap --exclude node_modules --exclude .git
spacemap --max-depth 3
spacemap --by size --size-buckets "1024,10240,102400,1048576"
Comma-separated byte values for bucket boundaries.
spacemap --by age --age-buckets "1,7,30,90,365"
Comma-separated day values for age boundaries.
# To stdout
spacemap --json
# To file
spacemap --output report.json
Terminal output shows:
When using --by type, files are grouped into these categories:
When using --json or --output, the output follows this structure:
{
"scanned_path": "string",
"mode": "type|size|age",
"totals": {
"total_bytes": 0,
"file_count": 0,
"dir_count": 0,
"skipped_paths": 0
},
"disk_usage": {
"total_space": 0,
"available_space": 0,
"used_space": 0,
"used_percent": 0.0
},
"buckets": [
{
"key": "string",
"label": "string",
"bytes": 0,
"percent": 0.0,
"file_count": 0
}
],
"top_files": [
{ "path": "string", "bytes": 0 }
],
"top_dirs": [
{ "path": "string", "bytes": 0 }
],
"warnings": [
{ "path": "string", "error": "string" }
]
}
disk_usage field may be null if disk information cannot be retrieved.
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Scan completed with warnings (some paths unreadable) |
| 2 | Invalid arguments |
| 3 | Runtime failure |
Licensed under either of: