Analyze disk usage and safely reclaim space on Linux servers. Built for server workloads such as journald, apt/dnf, Docker, logs, and common stacks (MySQL, PHP, Apache/Nginx, Baota).
Repository: crayonxiaoxin/Linux-Cleaner
- Disk analysis — directory size ranking and large file discovery (with progress + colors)
- Service insights — MySQL, PHP, Apache, Nginx, Baota path usage via
lc services - Safe cleanup — journal, package caches, rotated logs, temp files, user caches, Docker, service logs/sessions/old backups
- Full scan status — every cleaner shows cleanable / clean / skipped
- Dry-run by default —
lc cleanpreviews only; use--executeto delete - Self-update —
lc updateinstalls the latest GitHub Release (no Go required) - Protection — system paths, DB datadir, site roots, and whitelist are never deleted
- JSON output —
--jsonfor scripting and monitoring
# Recommended: install from GitHub Releases (no Go required)
curl -fsSL https://raw.githubusercontent.com/crayonxiaoxin/Linux-Cleaner/main/scripts/install.sh | bash
# Or build from source (requires Go)
make build
sudo make installlc # Show available commands
lc analyze [path] # Browse disk usage (default: /)
lc analyze --quick / # Faster: skip large-file scan
lc services # Analyze MySQL/PHP/Apache/Nginx/Baota disk usage
lc clean # Scan reclaimable space (dry-run, shows all cleaners)
lc clean --execute # Perform cleanup after confirmation
lc report # Disk summary (includes services)
lc history # View operation log
lc update # Install latest release
lc update --check # Check for updates only
lc version # Print version
lc --json report # JSON output for scripts
lc --no-color clean # Disable ANSI colorslc analyze /var
lc services
lc clean
lc clean --execute --only journal,mysql-logs,nginx-logs
lc update
lc report --json | jq '.total_reclaimable'cleandefaults to dry-run. Destructive operations require--executeand typingyes.- Never auto-deleted:
/, system dirs,/var/lib/mysql,/www/wwwroot,/www/server/panel, package databases. - User whitelist:
~/.config/lc/whitelist(one path prefix per line). - Disable operation logging:
LC_NO_OPLOG=1. - Many cleaners require root (
sudo lc clean --execute).
- Debian / Ubuntu (apt)
- RHEL / Rocky / Alma / CentOS (dnf/yum)
- Generic Linux with journald
- Optional stacks: MySQL/MariaDB, PHP, Apache, Nginx, Baota panel
make build # local binary in bin/lc
make test # run tests
make linux-amd64 # cross-compile for amd64
make linux-arm64 # cross-compile for arm64Requires Go 1.19+ (1.22+ recommended). See docs/release.md.
MIT