A CLI tool to analyze storage space on Linux and get actionable cleanup suggestions.
╔═══════════════════════════════════════════════════════════════════════════════╗
║ STORAGE ANALYZER ║
║ Analyze storage on Linux and get cleanup suggestions ║
╚═══════════════════════════════════════════════════════════════════════════════╝
- Scan directories - See size breakdown by subdirectories
- Find largest files - Identify the biggest files consuming space
- Find largest directories - See which directories use the most space
- List cleanable items - Detect caches, logs, and other cleanable items
- Get suggestions - Actionable recommendations with copy-paste commands
- Device filtering - Get suggestions for specific partitions/drives
- Multi-distro support - Detects available package managers and generates appropriate commands
- Package manager cleanup - Suggestions for apt, dnf, pacman, zypper, apk, flatpak, snap, docker
- System cleanup - Journal logs, old kernels, crash reports, etc.
- Temporary files cleanup - Clean old temp files from /tmp, /var/tmp
- Large file detection - Find files >100MB consuming space
$ storage-analyzer drives
Available Block Devices:
Disk: /dev/sda (238.5G)
└── /dev/sda1 976M /boot/efi
└── /dev/sda2 65.2G /
└── /dev/sda3 7.9G [SWAP]
└── /dev/sda4 145.3G /home$ storage-analyzer suggest --device /dev/sda2
Analyzing storage for cleanup suggestions on: /dev/sda2 (mounted at /)
⠧ Found 3 suggestions
╭───────────────────── 1. systemd journal logs (160.0 MB) ─────────────────────╮
│ Path: /var/log/journal │
│ │
│ Command to run: │
│ sudo journalctl --vacuum-size=100M │
╰──────────────────────────────────────────────────────────────────────────────╯
╭────────────────────── 2. APT package cache (132.7 MB) ───────────────────────╮
│ Path: /var/cache/apt │
│ │
│ Command to run: │
│ sudo apt-get clean │
╰──────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────── 3. Old kernel images (0 B) ─────────────────────────╮
│ Path: /boot │
│ │
│ Command to run: │
│ sudo apt-get autoremove --purge │
╰──────────────────────────────────────────────────────────────────────────────╯
╭────────────────────────────────── Summary ───────────────────────────────────╮
│ Total potential savings: 292.7 MB ║
╰──────────────────────────────────────────────────────────────────────────────╯$ storage-analyzer scan /home --depth 2
Scanning: /home
Depth: 2
⠸ Scanned 1234 files, 567 directories
╭────────────────────────────────── Summary ───────────────────────────────────╮
│ Total Size: 45.3 GB │
│ Files: 1234 │
│ Directories: 567 │
╰──────────────────────────────────────────────────────────────────────────────╯
Top Directories:
Path Size ─────────────────────────────────────────────────────────────────────
/home/user/Downloads 15.2 GB
/home/user/.cache 8.3 GB
/home/user/Videos 12.1 GB
...$ storage-analyzer disk
Disk Usage:
Metric Value
───────────────────
Total 238.5 GB
Used 127.3 GB
Free 111.2 GB
Usage 53.4% This tool is read-only by default:
- All analysis commands only read data
- Suggestions provide commands to run manually
- No files are automatically deleted
╔═══════════════════════════════════════════════════════════════════════════════╗
║ ⚠️ SAFETY NOTE ║
║ All suggestions show commands for you to run MANUALLY. ║
║ No files are deleted automatically. ║
╚═══════════════════════════════════════════════════════════════════════════════╝
Download the latest release from GitHub:
# Download the binary
curl -L -o storage-analyzer https://github.com/activatethefud/storage_analyzer/releases/latest/download/storage-analyzer
# Make it executable
chmod +x storage-analyzer
# Move to your PATH
sudo mv storage-analyzer /usr/local/bin/pip install storage-analyzerpip install -e .Or run directly:
python -m storage_analyzer <command>storage-analyzer drivesstorage-analyzer scan /home
storage-analyzer scan . --depth 3
storage-analyzer scan /home /tmpstorage-analyzer large-files /home
storage-analyzer large-files /home --top 20storage-analyzer large-dirs /home
storage-analyzer large-dirs /home --top 5storage-analyzer clean # All cleanable items
storage-analyzer clean --device /dev/sda2 # Only for root partition
storage-analyzer clean --device /dev/sda4 # Only for /home partitionstorage-analyzer suggest # All suggestions
storage-analyzer suggest --device /dev/sda2 # Only for root partition
storage-analyzer suggest --device /dev/sda4 # Only for /home partitionstorage-analyzer disk-
First, list all available devices:
storage-analyzer drives
-
Find the device you want (e.g.,
/dev/sda2for root,/dev/sda4for/home) -
Use
--deviceoption:storage-analyzer suggest --device /dev/sda2
- pip cache (~/.cache/pip)
- npm cache (~/.cache/npm)
- yarn cache (~/.cache/yarn)
- Thumbnail cache (~/.cache/thumbnails)
- Firefox cache (~/.cache/mozilla/firefox)
- Chrome cache (~/.cache/google-chrome)
- Chrome GPU cache (~/.config/google-chrome/Default/GPUCache)
- Trash (~/.local/share/Trash)
- Flatpak cache (~/.cache/flatpak)
- Flatpak data (~/.local/share/flatpak)
- Flatpak apps data (~/.var/app)
- npm global cache (~/.npm/_cacache)
- bun cache (~/.cache/bun)
- pnpm cache (~/.cache/pnpm)
- cargo registry (~/.cargo/registry)
- gradle caches (~/.gradle/caches)
- maven repository (~/.m2/repository)
- uv cache (~/.cache/uv)
- Steam cache (~/.steam)
- VirtualBox cache (~/.cache/VirtualBox)
- Rygel media server (~/.local/share/rygel, ~/.cache/rygel)
- Lollypop music cache (~/.cache/lollypop)
- VS Code cache (~/.config/Code/Cache, ~/.config/Code/CacheData)
The tool detects which package managers are installed and provides appropriate cleanup commands:
| Manager | Clean Command | Autoremove | Old Kernels |
|---|---|---|---|
| apt | apt-get clean |
apt-get autoremove |
apt-get autoremove --purge |
| dnf | dnf clean all |
dnf autoremove |
dnf remove oldest-kernel |
| pacman | pacman -Scc |
pacman -Rsn $(pacman -Qtdq) |
(auto by pacman) |
| zypper | zypper clean |
zypper rm -u |
zypper rm -u kernel-default |
| apk | apk clean |
apk del -r $(apk info -e) |
apk del linux-lts |
| flatpak | flatpak remove --unused |
- | - |
| snap | snap list --all |
- | - |
| docker | docker image prune -a |
- | - |
- systemd journal logs (
journalctl --vacuum-size) - Old kernel images (distro-specific commands)
- Crash reports (/var/crash)
- Old rotated log files
- Old temporary files (/tmp, /var/tmp - files older than 7 days)
# Find root device
storage-analyzer drives
# Get cleanup suggestions for root
storage-analyzer suggest --device /dev/sda2storage-analyzer suggest --device /dev/sda4storage-analyzer scan /home --depth 2
storage-analyzer large-files /home --top 20
storage-analyzer large-dirs /home --top 10python -m pytest tests/ -vpython -m pytest tests/test_suggestions.py -vGNU General Public License v3 (GPLv3)
╔═══════════════════════════════════════════════════════════════════════════════╗
║ Thanks for using Storage Analyzer! ║
║ Star us on GitHub: https://github.com/activatethefud/storage_analyzer ║
╚═══════════════════════════════════════════════════════════════════════════════╝