VS Code Bloat Cleaner
VS Code's remote server is well-known for filling up disk space over time. Each update leaves behind old server binaries, session logs accumulate, extension caches grow, and duplicate extension versions pile up. On shared servers this quietly kills the root partition.
This extension runs quietly in the background and keeps it all in check.
What it cleans
| Target |
Default |
Old VS Code server binaries (~/.vscode-server/bin/) |
✅ enabled |
Old CLI server installs (~/.vscode-server/cli/servers/) |
✅ enabled |
| Session log directories older than N days |
✅ 7 days |
| Cached extension VSIX downloads |
✅ enabled |
| Orphaned workspace storage (workspace folder deleted) |
✅ enabled |
Stale VS Code entries in /tmp (yours only, and only if unused) |
✅ enabled |
| Duplicate extension versions (keeps newest only) |
✅ enabled |
The currently running server version is always preserved. Nothing safety-critical is touched.
Features
- Auto-cleanup on startup — runs 10 seconds after VS Code finishes loading
- Scheduled cleanup — repeats every 24 hours by default
- Status bar — shows live
~/.vscode-server disk usage; click to run cleanup immediately
- Disk alert — pops a warning when usage exceeds a configurable threshold (default 2 GB)
- Dry-run mode — logs what would be deleted without removing anything
- Disk usage report — per-directory breakdown via the command palette
Commands
Open the Command Palette (Ctrl+Shift+P) and search for Bloat Cleaner:
| Command |
Description |
Bloat Cleaner: Run Cleanup Now |
Run all cleanup tasks immediately |
Bloat Cleaner: Show Disk Usage Report |
Show a breakdown of ~/.vscode-server disk usage |
Bloat Cleaner: Open Settings |
Jump to extension settings |
Settings
| Setting |
Default |
Description |
bloatCleaner.autoCleanOnStartup |
true |
Run cleanup when VS Code starts |
bloatCleaner.autoCleanIntervalHours |
24 |
Hours between scheduled cleanups (0 = disabled) |
bloatCleaner.keepServerVersions |
1 |
Extra server versions to keep beyond the running one |
bloatCleaner.logRetentionDays |
7 |
Delete session logs older than this many days |
bloatCleaner.cleanCachedVsix |
true |
Delete cached extension VSIX files |
bloatCleaner.cleanWorkspaceStorage |
true |
Delete storage for workspaces that no longer exist |
bloatCleaner.cleanTmpFiles |
true |
Delete stale VS Code entries in /tmp that you own and that no process has open (details) |
bloatCleaner.cleanDuplicateExtensions |
true |
Remove older installs of the same extension |
bloatCleaner.diskAlertThresholdGB |
2 |
Warn when ~/.vscode-server exceeds this size (GB) |
bloatCleaner.showStatusBar |
true |
Show disk usage in the status bar |
bloatCleaner.dryRun |
false |
Preview deletions without removing anything |
Notes
- Designed for remote/server environments (SSH, Tunnel, WSL). Works locally too but the gains are most significant on servers where VS Code updates frequently and old versions are never manually removed.
- The extension writes to exactly two locations: your own
~/.vscode-server directory, and VS Code-prefixed entries in the shared /tmp directory (see below). It does not touch your project files.
- Output from every cleanup run is logged to the Bloat Cleaner output channel for review.
- Relocated server directories are handled. If
~/.vscode-server (or individual version directories inside it) has been moved to another partition and symlinked back, cleanup follows the link and frees the real data on the other partition, then removes the link. It will not follow a link that resolves to /, a top-level system directory, your home directory, or the server root — those are logged and left alone.
/tmp cleanup on shared hosts
/tmp is not part of ~/.vscode-server — it is a system-wide directory shared by every user on the machine. On a multi-tenant or multi-session host, a VS Code-prefixed entry there may belong to another user, or to another live VS Code Remote session, and an old modification time does not mean it is unused: a long-running session can hold a socket or lock file that has not been written to in days.
Because of that, an entry in /tmp is removed only when all of the following hold:
- It is owned by your own user account (uid match).
- It is not a socket, FIFO, or symlink — live IPC endpoints are never removed.
- It is not held open by any running process, as reported by
lsof.
- It does not belong to the current VS Code session.
- Its modification time is older than 1 day.
If the extension cannot determine which entries are in use — for example when lsof is not installed — it skips /tmp cleanup entirely rather than guessing. Every skipped entry is logged with its reason in the Bloat Cleaner output channel.
Cleanup of /tmp is enabled by default and controlled by bloatCleaner.cleanTmpFiles. Set it to false to leave /tmp untouched. On Windows this step is skipped automatically.
License
MIT © SilverServers