sudo nano optimiza-linux-mint.sh

#!/bin/bash
set -e

echo "Limpiando paquetes innecesarios..."
sudo apt autoremove --purge -y
sudo apt autoclean
sudo apt clean

echo "Desactivando servicios innecesarios..."

disable_service() {
  if systemctl list-unit-files | grep -q "^$1"; then
    sudo systemctl disable "$1" && echo "Desactivado $1"
  else
    echo "Servicio $1 no encontrado, saltando..."
  fi
}

disable_service bluetooth.service
disable_service blueman-mechanism.service
disable_service cups.service
disable_service cups-browsed.service
disable_service ModemManager.service
disable_service speech-dispatcherd.service

echo "Instalando y activando zRAM..."
sudo apt install -y zram-tools

# Ajustar tamaño zram a 4GB
CONFIG_FILE="/etc/default/zramswap"
if grep -q "^ZRAM_SIZE=" "$CONFIG_FILE"; then
  sudo sed -i "s/^ZRAM_SIZE=.*/ZRAM_SIZE=4096/" "$CONFIG_FILE"
else
  echo "ZRAM_SIZE=4096" | sudo tee -a "$CONFIG_FILE"
fi

sudo systemctl enable --now zramswap.service

echo "Activando TRIM para SSD..."
sudo systemctl enable fstrim.timer
sudo systemctl start fstrim.timer

echo "Optimización completada."

sudo chmod +x optimiza-linux-mint.sh

./optimiza-linux-mint.sh