Disk cleanup
A portable, shareable collection of AI agent skills — structured instruction packs that teach coding agents how to perform specific tasks consistently.
npx -y skills add ebal/AI-Skills --skill disk-cleanupAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
3 things to look at
- 22 days oldThe repository was created 22 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Deploy and run a disk cleanup script on remote Debian/Ubuntu systems. Use when the user says "clean disk", "free space", "disk cleanup", "clean up server", "deploy cleanup", or wants to run /root/clean.sh on a remote host.
SKILL.md
3.0 KB, as published. Nobody here has run it
Disk Cleanup
Deploys and runs a disk cleanup script on remote Debian/Ubuntu systems. Removes old kernels, clears caches, vacuums logs, and prunes Docker/pip/npm — with before/after disk usage reporting.
Locating the script
Commands below use ${SKILL_DIR} for the folder that contains this skill. Set it to wherever the skill is installed, for example:
SKILL_DIR="$HOME/.claude/skills/disk-cleanup" # Claude Code
# SKILL_DIR="$HOME/.config/opencode/skills/disk-cleanup" # OpenCode / OpenWork
# On Claude Code you can also reuse the injected variable: SKILL_DIR="$CLAUDE_SKILL_DIR"
Quick Start
Deploy and run on a remote host:
# 1. Copy the script to the remote host
scp "${SKILL_DIR}/clean.sh" HOST:/tmp/clean.sh
# 2. SSH in and run as root
ssh HOST "sudo bash /tmp/clean.sh"
Or for a safe preview first:
ssh HOST "sudo bash /tmp/clean.sh --dry-run"
What It Does
| Step | What is cleaned |
|---|---|
| 1 | Old kernel images (keeps the running kernel) |
| 2 | Package documentation (/usr/share/doc/*) |
| 3 | systemd journal (keeps last 7 days) |
| 4 | apt cache (autoclean + clean) |
| 5 | Unused dependencies (autoremove --purge) |
| 6 | pip cache (if pip3 is installed) |
| 7 | npm cache (if npm is installed) |
| 8 | Docker unused images/containers/networks (if Docker is running) |
| 9 | Filesystem sync |
Prints disk usage before and after, with estimated MB freed.
Options
| Flag | Effect |
|---|---|
--dry-run | Show what would be deleted without touching anything |
-h / --help | Print usage info |
Deploying to Multiple Hosts
To deploy to a list of servers:
HOSTS="web1 web2 db1"
for host in $HOSTS; do
echo "=== $host ==="
scp "${SKILL_DIR}/clean.sh" "$host:/tmp/clean.sh"
ssh "$host" "sudo bash /tmp/clean.sh"
echo ""
done
Or use a dry-run across all hosts first:
for host in $HOSTS; do
echo "=== $host ==="
scp "${SKILL_DIR}/clean.sh" "$host:/tmp/clean.sh"
ssh "$host" "sudo bash /tmp/clean.sh --dry-run"
echo ""
done
Scheduling via Cron
To run weekly (e.g., every Sunday at 3 AM):
# On the remote host:
echo "0 3 * * 0 root /tmp/clean.sh >> /var/log/disk-cleanup.log 2>&1" \
> /etc/cron.d/disk-cleanup
Requirements
- Debian/Ubuntu system with
apt - Root access (script checks for
$EUID -ne 0) journalctlfor log vacuuming (systemd-based systems only)
Notes
- Journal vacuum keeps 7 days (configurable via
JOURNAL_MINvariable at top of script) - Docker/pip/npm cleanup is skipped automatically if not installed
- Safe to re-run — idempotent, no side effects on already-clean systems
- The script syncs the filesystem at the end to flush all writes