Skip to content

Instantly share code, notes, and snippets.

@mckabue
Created November 9, 2025 08:34
Show Gist options
  • Select an option

  • Save mckabue/5ea83d2fd4011f360679005e9653d2f0 to your computer and use it in GitHub Desktop.

Select an option

Save mckabue/5ea83d2fd4011f360679005e9653d2f0 to your computer and use it in GitHub Desktop.
#!/bin/bash
# 1. Empty Trash (3.2GB)
rm -rf ~/.local/share/Trash/*
# 2. Clear yarn cache (9.5GB)
rm -rf ~/.cache/yarn
# 3. Clear pip cache (1.7GB)
rm -rf ~/.cache/pip
# 4. Clear npm cache (4.0GB)
npm cache clean --force
# 5. Clear electron cache (850MB)
rm -rf ~/.cache/electron
# 6. Clear TypeScript cache (164MB)
rm -rf ~/.cache/typescript
# 7. Clear node-gyp cache (122MB)
rm -rf ~/.cache/node-gyp
# 8. Clear VS Code cache (256MB)
rm -rf ~/.config/Code/Cache
# 9. Clear VS Code cached extensions (386MB)
rm -rf ~/.config/Code/CachedExtensionVSIXs
# 10. Clear APT package cache (413MB) - requires sudo
sudo apt clean
# 11. Clear old journal logs (1GB) - requires sudo
sudo journalctl --vacuum-time=7d
# Update package lists
sudo apt update
# Upgrade installed packages
sudo apt upgrade -y
# Perform a full upgrade (including potentially removing obsolete packages)
sudo apt full-upgrade -y
# Clean up unnecessary packages
sudo apt autoremove -y
# Update package locations (optional)
sudo apt update --fix-missing
# Additional system maintenance (optional)
# You can uncomment and customize these commands as needed
# Clean system logs
# sudo logrotate -f /etc/logrotate.conf
# Update system time with an NTP server
# sudo ntpdate time.google.com
# This script can be further customized to:
# - Install specific packages using "sudo apt install package_name"
# - Update specific package locations using "sudo apt update <repository_url>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment