Remote SSH Cleaner
A VS Code extension that runs on the remote host to clean up old VS Code installations based on @XDflight’s script.
Features
- Automatic check at startup with notifications and action buttons;
- Preview before deletion;
- Cleans up downloaded VSIX files, CLI logs, and
.vsctmp folders;
- Retains the server reference via
cli/servers/lru.json;
- Retains the most recent version of each extension;
- Cleans
~/.cache only upon explicit activation.
Installation
Search "Remote SSH Cleaner" in VSCode store and click install.
Manual Installation
npm install
npx vsce package
Then use Extensions: Install from VSIX....
Commands
Remote SSH Cleaner: Preview Cleanup
Remote SSH Cleaner: Clean Now
Startup Check
By default, five seconds after a remote window is opened, the extension scans for items that can be cleaned up. If it finds any, a notification offers the following options:
- Clean Now: displays a confirmation prompt for deletion;
- View Details: Opens the preview in the output channel;
- Ignore: Closes the notification for this session.
Available settings:
remoteSshCleaner.checkOnStartup: Check at startup whether a cleanup is required;;
remoteSshCleaner.startupDelaySeconds: Delay in seconds before the automatic startup check;
remoteSshCleaner.cleanUserCache: Delete the complete ~/.cache directory. Disabled by default;
remoteSshCleaner.cleanDownloadedVsix: Delete data/CachedExtensionVSIXs;
remoteSshCleaner.cleanOldServers: Delete server versions not referenced by lru.json;
remoteSshCleaner.cleanOldExtensions: Keep only the newest version of each extension.
Dev Containers Compatibility
The extension works in a Dev Container window because it is declared as a workspace extension. It therefore runs inside the container and cleans up the container’s ~/.vscode-server folder.
Important Limitations:
- It does not clean the Docker host from within the container;
- In a Remote SSH followed by Dev Container configuration, it cleans the container, not the SSH host directly;
- If the container is recreated frequently, cleaning may be of little use since its filesystem is already replaced;
- The
~/.cache folder remains disabled by default.
Readable sizes are generated by @draconides/format using binary conversion, byte-based notation, minimal units, and French numeric formatting.
Acknowledgements
This project was initially developed with assistance from Microsoft 365 Copilot for code generation, documentation, and internationalization.
The code was subsequently reviewed, corrected, tested, and maintained by CIC-IT Nancy.