CleanSys - Modern System Cleaner (Linux, macOS, Windows)
CleanSys is a modern Linux system-cleanup utility available as both a terminal UI (Ratatui) and a desktop GUI (Iced). It helps you safely remove unnecessary files, clean caches, and free up disk space with real-time progress tracking.
π§± Project Structure
CleanSys is a Cargo workspace with three crates:
| Crate | Binary | Description |
|---|---|---|
cleansys-core |
(library) | Framework-free domain logic: cleaners, permission checks, formatting, sudo auth β shared by both front-ends |
cleansys-tui |
cleansys |
Ratatui terminal UI + CLI (the original CleanSys experience) β published to crates.io as cleansys |
cleansys-gui |
cleansys-gui |
Iced desktop GUI |
π¬ Demo
Main Demo
 β lists exactly what's selected, with an option to disable prompts (
yin the TUI) - Preview / dry-run mode β measure real sizes and paths that would be cleaned without deleting anything (
din the TUI, "Preview" button in the GUI) - Progress tracking β live per-item status plus an overall progress bar/percentage while a run is in flight
- Desktop notifications on completion (Linux/macOS/Windows)
π¨ Modern Terminal UI
- Beautiful Interface: Built with Ratatui for a smooth, modern experience
- Interactive Checkboxes: Easy selection using tui-checkbox library
- Animated loading spinner: tui-spinner renders a live braille spinner in the title bar while a cleaning run is in progress
- Multiple Chart Types: Toggle between Bar Chart, Pie Chart (by count), and Pie Chart (by size) β rendered directly by tui-piechart, with no local pie-drawing code of our own
- Split-View Progress: Detailed status information with real-time updates
- Animated Indicators: Loading spinners, progress bars, and status icons
- Responsive Design: Automatically adapts to any terminal size
- Real-time Resize: Handles terminal resizing without losing state
π§Ή User-Level Cleaning (Linux, macOS, Windows)
- Browser caches β Firefox, Chrome/Chromium, Edge, Safari (real per-platform paths, not guesses)
- Application caches
- Thumbnail/preview caches
- Temporary files owned by the current user
- Package manager caches (pip, npm, cargo)
- Trash / Recycle Bin (Linux XDG trash, macOS
~/.Trash, Windows Recycle Bin via Shell32)
π§ System-Level Cleaning (platform-appropriate, some require root/admin)
- Linux: apt/pacman/dnf caches, rotated logs + journald vacuum,
/var/cache, old kernels, crash reports - macOS: Homebrew cache (never run as root!), Xcode DerivedData, unavailable iOS/watchOS/tvOS Simulator caches, rotated system logs, diagnostic/crash reports
- Windows: Windows Update download cache,
C:\Windows\Temp, Recycle Bin (via the same Shell32 API Explorer's "Empty Recycle Bin" uses β no Administrator required for the current user's own bin)
Every cleaner reports real measured sizes β no estimates or guesses β and the detailed view/GUI activity log lists exactly which files/directories were removed and how many bytes each one freed.
π‘οΈ Safe by Default
- Never removes system-critical files
- Confirms before running operations
- Detailed logs of all actions
- Shows exactly what will be cleaned
- Individual cleaner selection
π¦ Installation
From crates.io
# Terminal UI + CLI
# Desktop GUI
From source
# Build everything
# Or install just one front-end
See justfile for the full list of development tasks (just --list).
π Usage
Interactive TUI (Default)
Simply run CleanSys to launch the interactive terminal interface:
# User-level cleaning
# System-level cleaning (requires root)
Desktop GUI
Prefer a graphical interface? Launch the Iced-based desktop app instead:
It presents the exact same cleaners as the TUI (shared via cleansys-core) with checkboxes per category, a "Run selected" button, and a live activity log. Selections are remembered across restarts. System cleaners will prompt for your sudo password (Unix) or an "Administrator required" notice with a one-click relaunch (Windows) the first time they're needed.
- Confirm before cleaning: clicking "Run selected" shows exactly what's about to be deleted before anything happens.
- Preview: click "Preview" to see real sizes/paths that would be cleaned without deleting anything.
- Progress bar: a live progress bar and "N/M" counter while a run (or preview) is in flight.
- Global selection: "Select all" / "Select none" buttons work across every category, not just the active tab.
- Desktop notification when a run finishes.
The top bar includes a theme selector with 43 built-in themes (Dracula, Nord, Solarized, Gruvbox, Catppuccin, Tokyo Night, Kanagawa, Rose Pine, and more) β pick one from the dropdown and it's applied instantly and remembered across restarts (saved to ~/.config/cleansys/settings.json).
Command-Line Interface
# Run terminal UI explicitly
# Run text-based interactive menu
# Run user-level cleaners with confirmation
# Run user-level cleaners without prompts
# Run system-level cleaners (requires root)
# Run system cleaners without prompts
# List all available cleaners
# Show verbose output
β¨οΈ Terminal UI Controls
Navigation
β/βorj/k: Navigate itemsTab/Shift+Tab: Switch between categoriesj/k: Scroll detailed items list (vi-style)PgUp/PgDn: Scroll operation logHome/End: Jump to first/last item
Actions
Space: Toggle selectionEnter: Run selected cleaners (shows a confirmation overlay first, unless disabled)d: Preview selected cleaners (dry-run β measures real sizes/paths, deletes nothing)a: Select all in current categoryn: Deselect all in current categoryA: Select all across every categoryN: Deselect all across every categoryy: Toggle confirmation prompts on/offESC: Cancel operation, close overlay, or return to menuq: Exit application
View Controls
c: Cycle chart types (Bar β Pie Count β Pie Size)m: Toggle compact modev: Cycle view modes (Standard/Compact/Detailed/Performance)p: Toggle performance statisticss: Toggle auto-scroll log/: Toggle search in detailed view?: Show/hide help
π± Responsive Design
CleanSys features a fully responsive terminal interface with multiple breakpoints:
| Terminal Width | Layout Features |
|---|---|
| < 60 columns | Minimal UI, chart hidden, essential information only |
| 60-79 columns | Compact layout with reduced chart |
| 80-119 columns | Balanced layout with full chart |
| 120+ columns | Spacious layout with maximum information density |
π― View Modes
- Standard Mode: Balanced layout with full feature visibility (default)
- Compact Mode: Condensed layout for smaller terminals (<25 rows)
- Detailed Mode: Maximum information density with extended statistics
- Performance Mode: Focus on operation metrics and real-time monitoring
π Chart Visualization
Press c to cycle through different chart types:
- Bar Chart: Traditional vertical bar chart showing cleaned items
- Pie Chart (Count): Distribution by number of items cleaned
- Pie Chart (Size): Distribution by bytes cleaned
All charts automatically adapt to terminal size and include:
- Percentages
- Legends
- Color coding
- Smart label positioning
π Detailed View
After cleaning operations, view comprehensive details:
- Complete list of cleaned files and directories
- Full file paths
- Individual file sizes
- Timestamps
- Scrollable with
j/korPgUp/PgDn - Search functionality with
/
π Examples
Interactive TUI
# Launch TUI (default behavior)
# Navigate with arrow keys
# Select cleaners with Space
# Press Enter to run
Quick Clean
# Clean user caches without prompts
# Clean system caches with verbose output
List Available Cleaners
Output:
AVAILABLE CLEANERS
User cleaners (no root required):
β’ Browser Caches
β’ Application Caches
β’ Thumbnail Caches
...
System cleaners (root required):
β’ Package Manager Caches
β’ System Logs
β’ System Caches
...
ποΈ Architecture
CleanSys is a Cargo workspace of three crates β see Project Structure above. Rough internal layout:
crates/
βββ cleansys-core/ # Shared, framework-free logic
β βββ src/
β βββ cleaners/ # user_cleaners.rs, system_cleaners.rs, cleaned_item.rs
β βββ model.rs # CleanerItem, CleanerCategory, Status, load_categories()
β βββ auth.rs # Sudo authentication helper
β βββ utils.rs # Permissions, formatting, confirmation prompts
βββ cleansys-tui/ # Ratatui TUI + CLI (binary: cleansys)
β βββ src/
β βββ app.rs # Application state and key-handling logic
β βββ events.rs # Terminal input/resize event handling
β βββ render.rs # UI rendering logic
β βββ pie_chart.rs # Thin adapter: our data -> tui-piechart::PieChart (no local drawing logic)
β βββ menu.rs # Text-based interactive menu
β βββ components/ # Reusable widgets (password prompt)
βββ cleansys-gui/ # Iced desktop GUI (binary: cleansys-gui)
βββ src/
βββ state.rs # Application state
βββ update.rs # Elm-style update logic
βββ view.rs # Rendering (tabs, cards, activity log)
βββ icons.rs # Bootstrap icon glyph constants
π₯οΈ Platform Support
Cleaners are real and platform-native on every OS β not just Linux paths
that happen to compile elsewhere. Each cleaner resolves OS-appropriate
locations (see cleansys-core::cleaners::platform)
and measures real freed bytes (no estimates).
| Platform | cleansys (TUI/CLI) |
cleansys-gui |
User cleaners | System cleaners |
|---|---|---|---|---|
| Linux (x86_64, aarch64) | β | β | Firefox/Chrome/Chromium caches, ~/.cache, thumbnails, /tmp, pip/npm/cargo caches, XDG Trash |
apt/pacman/dnf caches, rotated logs + journald vacuum, /var/cache, old kernels, crash reports (root required) |
| macOS (Intel + Apple Silicon) | β | β | Firefox/Chrome/Safari caches, ~/Library/Caches, QuickLook thumbnails, $TMPDIR, pip/npm/cargo caches, ~/.Trash |
Homebrew cache (not root β brew refuses to run as root), Xcode DerivedData, unavailable Simulator caches, rotated system logs, diagnostic/crash reports (root required) |
| Windows (x86_64) | β | β | Chrome/Edge/Firefox caches, Windows INetCache/CrashDumps, thumbnail cache, %TEMP%, pip/npm/cargo caches |
Windows Update download cache, C:\Windows\Temp (Administrator), Recycle Bin (via Shell32, no Administrator needed for your own bin) |
Windowing / desktop-environment support for cleansys-gui (via Iced/winit):
- Linux: X11 and Wayland (both enabled by default)
- macOS: native Cocoa/AppKit windowing (Intel + Apple Silicon, universal binary in releases)
- Windows: native Win32 windowing
The terminal UI (cleansys, via Ratatui/Crossterm) works in any terminal emulator on any of the three platforms.
See Releases for pre-built binaries: Linux .deb/.rpm/AppImage, Windows NSIS installer, and a universal macOS .dmg.
π§ͺ Testing
Run the test suite:
# Run all tests
# Run with output
# Run specific test module
π€ Automated Maintenance
A nightly Gitea Actions job (.gitea/workflows/deps-update.yml) upgrades every
workspace dependency pin, runs the full quality gate (fmt, clippy, test), andβ
if anything actually changedβautomatically cuts a new patch release: it
commits the dependency bump, then bumps the workspace version (X.Y.Z β
X.Y.Z+1), regenerates CHANGELOG.md, and pushes the tag directly to main.
No PR, no manual approval β pushing the tag triggers the normal Release
workflow (build, package, crates.io publish, AUR update). If the quality gate
fails at any point the job simply stops; nothing broken is ever released.
Run the same flow locally with just auto-patch-release.
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Links
π₯ Demo Creation
CleanSys uses VHS to create terminal session recordings. The demo tapes showcase:
demo.tape: Main demo showing both user and system cleanersuserland-cleaners.tape: Detailed walkthrough of user-level cleaning (no root required)system-cleaners.tape: Detailed walkthrough of system-level cleaning (requires authentication)
Generating Demos
# Install VHS (requires Go)
# See: https://github.com/charmbracelet/vhs#installation
# Generate main demo
# Generate userland cleaners demo
# Generate system cleaners demo
# Generate all demos
# Clean generated demos
All generated GIF files are output to demo/target/ and are git-ignored.
πΊοΈ Roadmap / Ideas
Things that would be natural next steps for the project (contributions welcome!):
- Scheduled/background cleaning β a small daemon or OS-native scheduler (systemd timer / launchd / Task Scheduler) integration to auto-clean on a cadence.
- Pluggable/custom cleaners β user-defined cleaner rules via a TOML config (glob patterns + safety checks), loaded by
cleansys-coreand shared by both front-ends. - GUI disk-usage chart β port the TUI's pie/bar chart (
tui-piechart) to an IcedCanvaswidget incleansys-guifor visual parity. - Light/dark auto-detection for the GUI theme (follow OS preference by default, falling back to the manual picker).
- Localization (i18n) for both UIs.
- JSON output for
cleansys list/cleansys user --yesetc., to make the CLI scriptable. - AUR / winget / Homebrew formulae for easier installation (AUR
PKGBUILDscaffold already included underpackaging/aur/). - TUI selection persistence β the GUI already remembers checked cleaners across restarts (
~/.config/cleansys/settings.json); the TUI could opt into the sametui-settings.jsonfile. - Branded icon/artwork β
packaging/windows/cleansys.icoandpackaging/macos/cleansys.icnscurrently fall back to a placeholder/no icon; real artwork would polish the installers/DMG.
π Acknowledgments
- Ratatui - Terminal UI framework
- tui-checkbox - Checkbox widget library
- tui-spinner - Animated loading spinner widget
- tui-piechart - Pie chart visualization widget
- Crossterm - Cross-platform terminal manipulation
- Iced - Cross-platform Rust GUI framework powering
cleansys-gui - iced_fonts - Bootstrap icon font for the GUI
- VHS - Terminal session recorder for creating demos
Note: Always review what will be cleaned before running system-level operations. While CleanSys is designed to be safe, it's good practice to understand what's being removed from your system.