Linux distribution ยท apt

Debian

A bigger pick-your-own checklist for default games, mail clients and LibreOffice, then autoremove and clear the cache.

Overview

Debian's default install is already fairly minimal, but this tool still scans a wider candidate list than before: games that come with the default desktop task, LibreOffice, mail and torrent clients, and Debian's usage-tracking package. Nothing is removed unless you pick it from the checklist.

Changes

  • Scans for, if installed: LibreOffice, GNOME Mines/Sudoku/2048/Iagno/Four-in-a-row, Aisleriot, Rhythmbox, Totem, Cheese, Shotwell, Simple Scan, Transmission, HexChat, Thunderbird, Evolution, GNOME Maps/Weather/Contacts/Clocks, and Popularity Contest
  • Shows a numbered checklist of what's actually installed - you choose which numbers to remove, 'all', or skip entirely
  • Runs apt-get autoremove --purge
  • Clears the apt package cache with apt-get clean

What stays

Anything not on the checklist, or on the checklist but not selected, is left alone. This script doesn't touch APT sources, pinning, or anything related to which Debian release you're tracking.

Command

curl -sSL https://debloatme.com/debian | bash

Script source

#!/usr/bin/env bash
#
# DebloatMe - Debian
# https://debloatme.com/debian
#
# What this script does:
#   1. Lets you pick, from a checklist, which optional apps to remove
#      (LibreOffice, default games, and a broader list of common
#      desktop bloat) - nothing is removed unless you select it
#   2. Runs apt autoremove with purge
#   3. Clears the apt package cache
#
# Reads confirmation prompts from /dev/tty so this still works when the
# script is piped straight from curl (curl ... | bash).
#
# Review this script before running it. Some listed packages may be relied
# on by other software on your system; the script checks before removing.

set -euo pipefail

echo "== DebloatMe: Debian =="
echo "This will remove selected packages and clear the apt cache."
read -r -p "Continue? [y/N] " confirm </dev/tty
if [[ ! "$confirm" =~ ^[Yy]$ ]]; then
  echo "Aborted. No changes made."
  exit 0
fi

# 1. Interactive checklist - nothing removed unless you pick it
echo
echo "-> Scanning for optional installed apps..."

candidate_ids=()
candidate_labels=()

lo_installed=$(dpkg -l 2>/dev/null | awk '/^ii  libreoffice/ {print $2}')
if [[ -n "$lo_installed" ]]; then
  candidate_ids+=("__libreoffice__")
  candidate_labels+=("LibreOffice (full suite)")
fi

check_pkg() {
  local pkg="$1" label="$2"
  if dpkg -s "$pkg" >/dev/null 2>&1; then
    candidate_ids+=("$pkg")
    candidate_labels+=("$label")
  fi
}

check_pkg "gnome-mines" "GNOME Mines"
check_pkg "gnome-sudoku" "GNOME Sudoku"
check_pkg "aisleriot" "Aisleriot (Solitaire)"
check_pkg "gnome-2048" "GNOME 2048"
check_pkg "iagno" "Iagno (Reversi)"
check_pkg "four-in-a-row" "Four-in-a-row"
check_pkg "popularity-contest" "Popularity Contest (usage stats)"
check_pkg "rhythmbox" "Rhythmbox"
check_pkg "totem" "GNOME Videos (Totem)"
check_pkg "cheese" "Cheese (webcam booth)"
check_pkg "shotwell" "Shotwell (photo manager)"
check_pkg "simple-scan" "Simple Scan"
check_pkg "transmission-gtk" "Transmission (torrent client)"
check_pkg "hexchat" "HexChat (IRC client)"
check_pkg "thunderbird" "Thunderbird (mail client)"
check_pkg "evolution" "Evolution (mail client)"
check_pkg "gnome-maps" "GNOME Maps"
check_pkg "gnome-weather" "GNOME Weather"
check_pkg "gnome-contacts" "GNOME Contacts"
check_pkg "gnome-clocks" "GNOME Clocks"

if [[ ${#candidate_ids[@]} -eq 0 ]]; then
  echo "   None of the optional apps on the list are installed."
else
  echo
  echo "Optional apps found on this system:"
  for i in "${!candidate_ids[@]}"; do
    printf "  [%d] %s\n" "$((i + 1))" "${candidate_labels[$i]}"
  done
  echo
  read -r -p "Enter numbers to remove (space-separated), 'all', or press Enter to skip: " selection </dev/tty

  indices=()
  if [[ "$selection" == "all" ]]; then
    for i in "${!candidate_ids[@]}"; do indices+=("$i"); done
  elif [[ -n "$selection" ]]; then
    for n in $selection; do
      idx=$((n - 1))
      if [[ $idx -ge 0 && $idx -lt ${#candidate_ids[@]} ]]; then
        indices+=("$idx")
      fi
    done
  fi

  if [[ ${#indices[@]} -eq 0 ]]; then
    echo "   Nothing selected. Skipping."
  else
    for idx in "${indices[@]}"; do
      id="${candidate_ids[$idx]}"
      if [[ "$id" == "__libreoffice__" ]]; then
        echo "   Removing LibreOffice packages:"
        echo "$lo_installed" | sed 's/^/     /'
        sudo apt-get -y purge $lo_installed || true
      else
        echo "   Removing $id"
        sudo apt-get -y purge "$id" || true
      fi
    done
  fi
fi

# 2. autoremove
echo
echo "-> Running apt autoremove --purge..."
sudo apt-get -y autoremove --purge

# 3. Clear apt cache
echo
echo "-> Clearing apt package cache..."
sudo apt-get clean

echo
echo "== Done. =="

rm -- "$0" 2>/dev/null || true

Warning

This script modifies your system

Package names on the checklist assume a GNOME-flavored default install. On other desktop tasks (KDE, Xfce, etc.), most of these simply won't be installed and the checklist will come back short.

  • Self-deletion: this script removes its own temporary downloaded copy after it finishes. That's a cleanup step, not a security feature.
  • Review the source above before running it, especially on a system you can't easily restore.