I hope you're all having a great day! I'm reaching out to seek your assistance in creating a script for a specific task in Zorin OS. As someone who values efficiency and a clutter-free system, I want to make a script for my system that simplifies the process of removing unwanted packages from my Zorin OS installation.
here is the script:
#!/bin/bash
# Check if the script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root (use sudo)"
exit 1
fi
# Color codes
WHITE='\033[0;97m'
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Get the total number of installed packages
total_installed_packages=$(dpkg -l | grep ^ii | wc -l)
# Create a line of underscores
line="------------------------------------"
echo -e "${WHITE}${line}"
echo -e "| |"
echo -e "|${GREEN} Installed packages: $total_installed_packages ${NC}|"
echo -e "| |"
echo -e "${line}"
# List of packages to uninstall
packages=(
gimp
brasero
cheese
gnome-characters
gnome-mahjongg
gnome-maps
gnome-mines
aisleriot
evolution
gnome-contacts
libreoffice-base-core
libreoffice-common
libreoffice-core
libreoffice-draw
libreoffice-gnome
libreoffice-gtk3
libreoffice-help-common
libreoffice-help-en-us
libreoffice-impress
libreoffice-style-colibre
libreoffice-style-elementary
libreoffice-style-yaru
libreoffice-writer
gnome-photos
quadrapassel
gnome-sudoku
gnome-todo
gnome-tour
gnome-menus
gnome-remote-desktop
gnome-sound-recorder
gnome-user-docs
gnome-video-effects
gnome-weather
gnome-system-monitor
gnome-remote-desktop
simple-scan
plymouth-label
plymouth-theme-spinner
plymouth-theme-ubuntu-text
plymouth-theme-zorin-logo
plymouth-theme-zorin-text
plymouth
printer-driver-all
printer-driver-brlaser
printer-driver-c2050
printer-driver-c2esp
printer-driver-cjet
printer-driver-dymo
printer-driver-escpr
printer-driver-fujixerox
printer-driver-gutenprint
printer-driver-hpcups
printer-driver-hpijs
printer-driver-m2300w
printer-driver-min12xxw
printer-driver-pnm2ppa
printer-driver-postscript-hp
printer-driver-ptouch
printer-driver-pxljr
printer-driver-sag-gdi
printer-driver-splix
zorin-gnome-tour-autostart
zorin-os-docs
zorin-os-printer-test-page
zorin-os-tour-video
zorin-sound-theme
zorin-windows-app-support-installation-shortcut
)
# Prompt to show packages that will be removed
echo -e "${RED}The following packages will be removed:${NC}"
for package in "${packages[@]}"; do
echo -e "| ${RED}$package ${NC}|"
done
echo -e "${line}"
read -n 1 -s -r -p "Press any key to continue..."
# Uninstall packages
for package in "${packages[@]}"; do
sudo apt remove "$package" -y
echo -e "${line}"
echo -e "| ${GREEN}\"$package\" is removed ${NC}|"
echo -e "${line}"
packages_removed=$((packages_removed + 1))
packages_left=$((total_packages - packages_removed))
done
# Additional cleanup
sudo apt autoremove -y
sudo apt clean -y
echo -e "${line}"
echo -e "| |"
echo -e "|${GREEN} Installed packages: $total_installed_packages ${NC}|"
echo -e "| |"
echo -e "${line}"
echo -e "${NC}" # Reset color
echo "All packages uninstalled and unnecessary files cleaned."
read -p "Press Enter to exit."
Github link Check out the Zorin OS Uninstaller Script on GitHub