$disk-management

Linux Disk Management Scripts

5 scripts · find, free, and monitor disk space · no install required

A disk that fills to 100% doesn't send a warning. It stops writing. Databases start corrupting. Log rotations fail silently. Web servers start returning 500 errors for reasons that look unrelated to disk space. The root cause is always: something grew and nobody was watching.

The scripts on this page are the watching. disk-space-warning catches the growth before it becomes an outage. find-large-files-linux finds what grew. delete-old-log-files clears the most predictable source of unbounded growth. find-duplicate-files finds the copies you forgot were copies. docker-prune-cleanup reclaims the gigabytes Docker silently accumulates.

The discipline is to run disk-space-warning on a cron and treat its output as a chore list, not an alert. At 80% full you have time to investigate. At 95% you are doing emergency surgery. The five scripts here represent the five questions in that investigation: how full is it, what's taking the space, can I delete the old logs, are there duplicate copies I forgot about, and is Docker holding hidden storage?

Log growth is almost always the first thing to prune. Application logs, nginx access logs, systemd journal dumps — on a server that's been running for a year without rotation configured correctly, /var/log can hold tens of gigabytes of files you've already read and will never need again. delete-old-log-files handles this with a configurable age threshold and a dry-run flag.

Duplicate files are the second most common cause of unexpected disk usage after logs. Git repositories, downloaded archives, database dump files that got copied to multiple locations — find-duplicate-files uses md5sum to catch byte-for-byte duplicates across directory trees. On a server that's been used as a shared workspace, the space reclaimed is often surprising.

When the fix is more disk, not less data — DigitalOcean droplets scale storage in minutes.

Get $200 free credit — DigitalOcean

Get $200 Free →

Affiliate link · we earn a commission

Scripts in This Collection (5)

Disk Space Warning Script

Checks every mounted filesystem and fires an alert when usage crosses a configurable threshold. The early warning system.

Full guide →

Find Large Files in Linux

Finds the biggest files and directories on any path. Answers "what is eating my disk" in one command.

Full guide →

Delete Old Log Files

Removes log files older than a configurable number of days. Handles the most predictable source of unbounded disk growth.

Full guide →

Find Duplicate Files

Uses md5sum checksums to find byte-for-byte duplicate files across a directory tree.

Full guide →

Docker Cleanup Script

Removes stopped containers, unused images, dangling volumes, and build cache. Reclaims the space Docker accumulates silently.

Full guide →