How to Clean Headless Servers with BleachBit's New TUI Interface
Introduction
BleachBit, the well-known open-source system cleaner, has introduced a text-based user interface (TUI) as an optional alternative to its standard graphical frontend. While the existing command-line interface (CLI) is designed for non-interactive scripting, the new TUI is fully interactive. You navigate it with your keyboard (with limited mouse support) to select, preview, and remove unnecessary files. This makes BleachBit an ideal tool for headless Linux servers managed remotely, as well as lightweight desktop systems where adding GTK dependencies isn't desirable. Currently in alpha, the TUI runs on the same backend as the GUI, ensuring consistent cleaning power. This guide will walk you through setting up and using BleachBit's TUI on a headless server.

What You Need
- A Linux server (headless) with SSH access
- Sudo or root privileges for installation
- An internet connection to download BleachBit
- Basic familiarity with the command line
Step-by-Step Guide
Step 1: Install BleachBit with TUI Support
First, ensure your system is updated. Then install BleachBit using your package manager. The TUI is included in standard packages from version 4.6.0 onward. For Ubuntu/Debian, run:
sudo apt update
sudo apt install bleachbit
For other distributions, use dnf (Fedora), zypper (openSUSE), or compile from source. Verify installation with bleachbit --version. If you need the latest alpha, check the official website.
Step 2: Access the TUI
Unlike the GUI, the TUI launches directly from the terminal. Connect to your headless server via SSH. Then run:
bleachbit --tui
If the flag isn't recognized, ensure you have the correct version. The TUI will open as a full-screen interactive interface. You can also set an alias for convenience:
alias bleachbit-tui='bleachbit --tui'
Step 3: Navigate the Interface
The TUI uses keyboard shortcuts. Use the arrow keys to move between categories and items. Press Tab to switch between panes (e.g., categories list and details). Spacebar toggles selection of an item. Enter expands or collapses a category. Esc returns to previous screen or exits. Limited mouse support exists: you can click on buttons and checkboxes. Familiarize yourself with the layout:
- Left pane: Cleaning categories (e.g., System, Applications, Custom)
- Right pane: Specific items with checkboxes and description
- Bottom bar: Action buttons (Preview, Clean, Quit)
Step 4: Preview and Select Items to Clean
Before cleaning, preview to see what will be removed. Navigate to a category, select one or more items with Spacebar, then press F5 or click Preview. This calculates space to be freed and lists files. Review carefully—some items (like browser caches) might be needed. To deselect, press Spacebar again. Continue selecting across categories.

Step 5: Clean Your Server
Once satisfied with your selection, press F6 or click Clean. Confirm the action if prompted. The TUI will remove the files and show progress. After completion, you'll see a summary of space freed. You can repeat steps 3-5 for different categories. The TUI supports undo for some operations (if enabled). To exit, press Esc or click Quit.
Step 6: Use TUI for Remote Headless Servers
Since the TUI runs entirely in the terminal, you can manage servers via SSH without a GUI. This is ideal for headless servers where you need interactive cleaning without installing X11 or GTK. The low dependencies make it suitable for lightweight environments. You can also run multiple instances or script periodic cleanups using the CLI (non-interactive) while using the TUI for manual, detailed cleanups. Remember to run with appropriate privileges (sudo bleachbit --tui) to clean system-wide temporary files.
Tips for Best Results
- Test on a non-critical server first. While BleachBit is safe, preview everything before cleaning.
- Enable undo: Run
bleachbit --tui --preserve-undoto allow recovery. - Combine with cron: For automated cleaning, use the CLI (
bleachbit --clean) in scheduled scripts. - Custom cleaning: Create custom cleaners by editing configuration files (advanced).
- Update regularly: The TUI is alpha software; improvements may fix issues.
- Check for dependencies: If you get a blank screen, ensure your terminal supports 256 colors (set
TERM=xterm-256color).
BleachBit's TUI brings powerful interactive cleaning to headless servers without bloat. By following these steps, you can free up disk space, improve performance, and maintain your server's health—all from the command line.
Related Discussions