惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
D
Docker
有赞技术团队
有赞技术团队
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
H
Help Net Security
美团技术团队
MyScale Blog
MyScale Blog
B
Blog RSS Feed
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
阮一峰的网络日志
阮一峰的网络日志
A
About on SuperTechFans
小众软件
小众软件
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
G
Google Developers Blog
月光博客
月光博客
Google DeepMind News
Google DeepMind News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
TIL: Snaps Are Secretly Eating Your Disk Space (Here’s Ho...
Zayan Mohame · 2026-05-08 · via DEV Community

Zayan Mohamed

If you use Linux as your daily driver, you’ve probably noticed your root partition quietly shrinking over time. You run ncdu or df -h, poke around your directories, and wonder: Where did all my storage go?

Today I Learned (TIL) that a massive chunk of that missing space might be hiding in plain sight.

The "Secret" Snap Stash 📦

Package managers like Snap and Flatpak are incredibly convenient for cross-distribution app installations. However, Snap has a habit of hoarding.

By default, Snap secretly keeps the last 2 or 3 versions of every single application you install. The logic behind this is sound: if a new update breaks an app, you can easily roll back to the previous working version.

But over time? This "just in case" feature wastes gigabytes of valuable disk space, keeping obsolete binaries on your system indefinitely.

The Solution: Cleaning Up Old Snaps 🧹

You can easily reclaim this space by removing the old, "disabled" versions of your snaps. Instead of doing this manually one by one, here is a handy bash script that automates the cleanup:

#!/bin/bash
set -eu

# Find all disabled snaps and remove them
sudo snap list --all | awk '/disabled/{print $1, $3}' |
    while read snapname revision; do
        sudo snap remove "$snapname" --revision="$revision"
    done

Enter fullscreen mode Exit fullscreen mode

How it works:

  1. snap list --all lists every snap installed, including the inactive older versions.
  2. awk '/disabled/{print $1, $3}' filters that list to only grab the names and revision numbers of the snaps marked as "disabled".
  3. The while loop iterates through them and safely runs the snap remove command for those specific old revisions.

Bonus: Don't Forget Flatpak! 🧽

While you're doing spring cleaning, you should check on your Flatpaks, too. Flatpak doesn't hoard app versions the same way Snap does, but it does leave behind orphaned runtimes (dependencies) when you uninstall apps.

You can purge all unused Flatpak runtimes with one simple command:

flatpak uninstall --unused

Enter fullscreen mode Exit fullscreen mode

The Result 📈

Running these two snippets on a machine that hasn't been cleaned in a year can easily free up anywhere from 2GB to 10GB+ of space.

If you just ran this on your machine, drop a comment below—I'm curious to see who holds the record for the most gigabytes reclaimed! 👇


Do you have any other favorite Linux cleanup commands? Let's hear them in the comments!