Disk usage

2 snippets across 2 stacks — Bash & Linux, Docker

SHBash & Linux

Disk Space Usage

SH · System Info
syntax
df [options] [filesystem]
example
df -h
df -h /
df -hT
output
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda1      ext4   50G   32G   16G  67% /
/dev/sdb1      xfs   200G  145G   55G  73% /data

Note -h for human-readable sizes. -T shows filesystem type. -i shows inode usage (you can run out of inodes even with free space if you have millions of tiny files). Check df regularly on servers to prevent disk-full outages.

DKDocker

Disk Usage Breakdown

DK · Debugging
syntax
docker system df [-v]
example
docker system df
docker system df -v
output
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          15        5         4.2GB     2.8GB (66%)
Containers      8         3         125MB     95MB (76%)
Volumes         6         3         1.1GB     400MB (36%)
Build Cache     -         -         850MB     850MB

Note Quick overview of what is consuming disk. Add -v for a per-item breakdown. The RECLAIMABLE column shows how much you can free with prune commands.