{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreihsj2yuzij66but6fetsnz7oxpf5ow2wmhhd32t6x6iwlx6etydfa",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mokqla25y6z2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreigtg7r2gjqaysxkvxog3wwv5ipimnrueg7q4dhmjnags2225x2ray"
    },
    "mimeType": "image/webp",
    "size": 68672
  },
  "path": "/mayne-x/i-reclaimed-12gb-from-my-ssd-with-one-terminal-command-and-you-can-too-3g9k",
  "publishedAt": "2026-06-18T11:21:50.000Z",
  "site": "https://dev.to",
  "tags": [
    "cli",
    "productivity",
    "node",
    "opensource",
    "⭐ Star the repo on GitHub",
    "@clack"
  ],
  "textContent": "I've been a developer for over a decade, and if there's one thing I've learned, it's that our hard drives are basically landfills for build artifacts.\n\nA few weeks ago, I was down to **2GB free** on my main SSD. Not because I had tons of important files — but because I had years worth of `node_modules` folders, `.next` build caches, `dist` directories, and other junk scattered across dozens of old projects.\n\nI tried reclaiming space manually. You know the drill — `du -sh` to find the culprits, then `rm -rf` them one by one. It works, but it's tedious. I tried `npkill` — it only handles `node_modules`. I tried `wipe-modules` — same limitation. I wanted something that could find everything at once and let me pick what to delete in one go.\n\nSo I built ZapDir.\n\n##  What is ZapDir?\n\nZapDir is a terminal cleanup tool that scans your projects for heavy build artifacts and lets you delete them through a beautiful interactive interface. It's completely free, open-source under MIT, and runs on Windows, macOS, and Linux with Node.js 18+.\n\n\n\n    npm install -g zapdir\n    zapdir\n\n\nRun that, and you'll see something like this:\n\n\n\n    ⚡  ZapDir  —  Terminal Cleanup Tool\n\n      🗑  Junk Found — Total recoverable:  1.47 GB\n\n      ██████████  node_modules    /node_modules      245.23 MB\n      ██████░░░░  .next           /.next               1.23 GB\n      ██░░░░░░░░  dist            /dist                89.45 MB\n\n      ✔  Delete 3 item(s) freeing 1.47 GB?  ·  Yes\n\n      ✔  Freed 1.47 GB of disk space!\n\n\nThe colored size bars make it obvious what's eating the most space at a glance — red for anything over 500MB, yellow for over 100MB, and green for the rest.\n\n##  What makes it different from npkill or wipe-modules?\n\nThere are other cleanup tools out there, but most of them only handle one pattern. Here's how ZapDir compares:\n\nFeature | ZapDir | npkill | wipe-modules\n---|---|---|---\n**Patterns detected** | 13+ | 1 (node_modules) | 1 (node_modules)\n**Interactive TUI** | ✅ | ✅ | ❌\n**Color-coded sizes** | ✅ | ❌ | ❌\n**Dry-run preview** | ✅ | ❌ | ❌\n**Async scanner** | ✅ | ❌ | ❌\n**Cross-platform** | ✅ | ✅ | ✅\n\nZapDir detects: `node_modules`, `.next`, `.nuxt`, `.turbo`, `dist`, `build`, `.cache`, `coverage`, `out`, `target`, `.parcel-cache`, `__pycache__`, and `.DS_Store`.\n\n##  What it found on my machine\n\nI ran ZapDir across my development machine and here's what turned up:\n\nLocation | What was there | Space recovered\n---|---|---\n~/Projects/legacy-app |  `node_modules` + `.next` | 1.8 GB\n~/Projects/side-project |  `node_modules` + `build` | 640 MB\n~/Projects/old-tutorial | `node_modules` | 420 MB\n~/.cache | Various caches | 340 MB\nVarious Rust projects |  `target/` directories | 2.1 GB\nOld Next.js projects |  `.next` caches | 3.4 GB\nAbandoned monorepos |  `node_modules` × 5 | 2.2 GB\nPython projects |  `__pycache__` + `.cache` | 180 MB\n\n**Total reclaimed: roughly 12 GB**\n\nThat's 12 GB I got back without touching a single file I actually needed. The biggest wins were old Next.js projects with massive `.next` caches (some over 1 GB each) and Rust projects where `target/` directories had accumulated to over 2 GB combined.\n\n##  Is it safe?\n\nShort answer: yes, if you use `--dry-run` first.\n\n\n\n    zapdir --dry-run ~/Projects\n\n\nThis scans and shows you exactly what would be deleted without actually removing anything. The output shows every item with its size, path, and a visual bar so you know exactly what you're getting into.\n\nWhen you're satisfied with the preview, run it without the flag. You'll be prompted to confirm before anything is deleted:\n\n\n\n    ✔  Delete 3 item(s) freeing 1.47 GB?  ·  Yes / No\n\n\nThe scanner uses `fs.promises.readdir` with async parallel traversal for speed, and deletion is done with `Promise.allSettled` so a permission error on one file won't crash the entire operation — it just skips that file and continues. I've been using it for weeks and haven't lost a single file I needed.\n\n##  How the scanning works\n\nThe core logic is surprisingly straightforward. It walks directories recursively using Node.js's built-in `fs.promises`, matches directory names against a list of known artifact patterns, calculates sizes using a streaming iterator (to avoid memory issues on huge folders), and presents everything in an interactive selection menu powered by `@clack/prompts`.\n\nHidden directories like `.git` are skipped by default for speed. The entire scan of my home directory — thousands of folders — completes in under 10 seconds.\n\n##  A practical tip\n\nHere's what I do now: once a month, I run:\n\n\n\n    zapdir --dry-run ~/Projects\n\n\nThis gives me a quick health check of how much junk has accumulated. When the number crosses 1 GB, I run it for real and reclaim the space. It's become part of my regular maintenance routine, right alongside `brew update` and `npm outdated`.\n\n##  Give it a shot\n\nIf you're running low on disk space and have old projects lying around, try it:\n\n\n\n    npm install -g zapdir\n    zapdir\n\n\nIt takes five seconds to install and could free up gigabytes. The code is open source under MIT, so you can inspect exactly what it does before running it.\n\n**⭐ Star the repo on GitHub** if you find it useful — it helps other developers discover it too.\n\n_ZapDir is MIT licensed and open source. Contributions, feature requests, and bug reports are welcome on GitHub._",
  "title": "I reclaimed 12GB from my SSD with one terminal command (and you can too)"
}