There is exactly such a command! DF(1) is installed by default on most linux distributions:
df -h
The df
command reports file system disk space usage. The -h
option added above specifies that the disk sizes printed should use "human-readable" formatting (e.g. 10G
instead of 1000000000
).
The output of df -h
should look something like this:
Filesystem Size Used Avail Use% Mounted on
udev 16G 0 16G 0% /dev
tmpfs 3.1G 940K 3.1G 1% /run
/dev/nvme0n1p1 7.6G 6.7G 993M 88% /
tmpfs 16G 0 16G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/loop1 79M 79M 0 100% /snap/core/7399
/dev/loop2 16M 16M 0 100% /snap/amazon-ssm-agent/1334
/dev/loop3 16M 16M 0 100% /snap/amazon-ssm-agent/1454
/dev/nvme0n1p15 98M 122K 98M 1% /boot/efi
/dev/nvme1n1 984G 852G 88G 91% /data
/dev/nvme2n1 984G 358G 576G 39% /data2
/dev/loop4 79M 79M 0 100% /snap/core/7716
tmpfs 3.1G 0 3.1G 0% /run/user/1000
To learn more about df
and other commands you are curious about, use the man pages:
man df
EDIT: Props to @HBruijn for pointing out in the comments that disk space occupied by filesystem (revealed via df
) and disk block-device size are not the same thing; for block-device info, use the command lsblk
:
lsblk -o NAME,UUID,SIZE,FSTYPE,TYPE,MOUNTPOINT
This command is human-readable by default, and you can customize the columns outputted with the -o
flag (discover column options by running lsblk --help
). For the options specified above, my machine reads out:
NAME UUID SIZE FSTYPE TYPE MOUNTPOINT
loop1 78.5M squashfs loop /snap/core/7399
loop2 15.4M squashfs loop /snap/amazon-ssm-agent/1334
loop3 15.4M squashfs loop /snap/amazon-ssm-agent/1454
loop4 78.9M squashfs loop /snap/core/7716
nvme0n1 8G disk
├─nvme0n1p1 97edfc69-5417-46ce-b9a5-62bd731a4233 7.9G ext4 part /
└─nvme0n1p15 ED7D-760A 99M vfat part /boot/efi
nvme1n1 d1a6a2bb-8e53-4043-af05-f2e9ffa60c55 1000G ext4 disk /data
nvme2n1 b9d28a71-2d98-44a9-a37f-530effb88ba2 1000G ext4 disk /data2