Skip to content

Latest commit

 

History

History
75 lines (50 loc) · 2.12 KB

File metadata and controls

75 lines (50 loc) · 2.12 KB

Snap Disabled Versions Cleanup Script

This Python script removes all disabled or old Snap packages from an Ubuntu-based system.

Features

  • Uses subprocess for secure command execution.
  • Automatically removes all old/disabled Snap revisions.
  • Restarts snapd service and checks its status.

Note: This script requires sudo privileges since it modifies system-level Snap installations.

Direct Setup

Clone this repo and make scripts executable to run the cleanup:

git clone --recurse-submodules https://github.com/m1st0/snap-cleanup.git snap_cleanup
cd snap_cleanup
chmod a+x snap_cleanup.py
sudo snap_cleanup.py

Git Submodule Setups

  • If desired as a submodule:

    git submodule add https://github.com/m1st0/snap-cleanup.git vendor/snap_cleanup
    git add .gitmodules vendor/snap_cleanup

    Commit as necessary.

  • If cloning a project that uses this repo as a submodule:

    git clone --recurse-submodules <parent repo>
  • If the project was already cloned without its submodules in the parent repo:

    git submodule update --init --recursive

Requirements

  • Python 3
  • Git

License

Copyright © 2025–2026 Maulik Mistry

This project is licensed under Apache License 2.0. See the LICENSE.txt file for details.

Support

If you find this project useful and would like to support me, consider donating:

References