Find what is filling your Linux disk, how fast it is growing, and which process is writing it.
diskc is a read-only, SRE-focused CLI that combines the usual df, df -i, du, find, lsof, ps, and /proc investigation into one workflow.
Build and run from source:
go build -o diskc ./cmd/diskc
./diskcThe default command scans /, samples growth for three seconds, and reports filesystem pressure, largest files/directories, growth rate, estimated time-to-full, and writable processes. Add --deleted to include deleted-open file detection.
diskc is read-only and does not require sudo or root privileges. Linux /proc permissions may limit process details for other users.
$ ./diskc
Disk pressure: WARNING 92.4% used (38.0 GB free)
Inodes: 41.0% used | /
Trend: +2.4 GB/hour
Estimated filesystem full: ~35 minutes
Largest files
74.8 GB /var/log/payment/app.log (log) ↑ 18.2 MB/s [1 writer(s)]
42.1 GB /tmp/upload-883120.bin (temporary/cache) ↑ 11.8 MB/s
Active writers
/var/log/payment/app.log
└─ PID 21819 payment-api
├─ exe /opt/payment/bin/payment-api
└─ service payment.service
Potential issues
/var/log/payment/app.log
├─ rapid growth: 65.5 GB/hour
└─ filesystem full in ~35 minutes
Inspect a directory or filesystem:
./diskc /var
./diskc /var/log --top 50 --depth 6Measure growth over a custom window:
./diskc /var --sample 5sInspect multiple filesystems explicitly:
./diskc / /data /backup --sample 5sDiscover physical filesystems automatically:
./diskc --all --sample 5sVirtual filesystems such as /proc, /sys, tmpfs, and cgroups are excluded. Separate filesystem results are never mixed.
Watch continuously until Ctrl-C:
./diskc -watch
./diskc --watch --interval 5s /dataThe default refresh interval is three seconds between refresh starts. If a scan takes longer, the next refresh starts immediately.
Find deleted-but-open files:
./diskc --deletedExample:
Deleted but still open
38.2 GB /var/log/payment/app.log ← payment-api (PID 21819)
./diskc /data --top 50 --sample 3s --deleted --json > disk-report.jsonFor multiple filesystems, JSON output is an array:
[
{
"filesystem": {
"path": "/data",
"used_percent": 92.4,
"inode_percent": 41
},
"files": [
{
"path": "/data/events.log",
"size_bytes": 13314398617,
"kind": "log",
"growth_bytes_per_second": 4299161,
"writers": [{"pid": 21819, "process": "payment-api", "exe": "/opt/payment/bin/payment-api", "uid": "1001"}]
}
]
}
]With --watch --json, each refresh is emitted as a separate JSON document without terminal-control sequences.
Requires Go 1.22 or newer:
go run ./cmd/diskc
go build -o diskc ./cmd/diskcThe module is organized for Homebrew. After publishing a tap:
brew tap your-org/diskc
brew install diskcThe formula builds ./cmd/diskc and installs the resulting diskc binary.
--top N number of large files (default: 20)
--depth N maximum directory depth (default: 4)
--sample DURATION measure growth (default: 3s; use 0 to disable)
--deleted include deleted files held open by processes
--json emit machine-readable JSON
--all inspect all mounted physical filesystems
--watch refresh continuously until interrupted
--interval DURATION watch refresh interval (default: 3s)
Parts of this project, including source code, documentation, examples, and configuration, may be generated or assisted by artificial intelligence. The project is provided on an “AS IS” and “AS AVAILABLE” basis, without warranties of any kind.
Use diskc at your own risk. The authors, maintainers, contributors, and distributors are not liable for any damage, data loss, corruption, downtime, outage, security incident, or other loss arising from the use of all or any part of this project. Review, test, and validate the code and its output before using it in production.
The project uses only the Go standard library. Linux builds use filesystem statistics and /proc metadata.
Run formatting, tests, static analysis, and builds with:
gofmt -w cmd internal
go test ./...
go vet ./...
go build ./cmd/diskc
GOOS=linux GOARCH=amd64 go build -o diskc-linux ./cmd/diskcPull requests and issues are welcome at github.com/diskc-cli/diskc.