How to find out disk space usage on the command line

If you want to know how much disk space you have left on your machine you can run this command on the command line:

df -h

Which produces something like this:

Filesystem      Size   Used  Avail Capacity  iused               ifree %iused  Mounted on
/dev/disk1s1   234Gi  213Gi   10Gi    96%  4602216 9223372036850173591    0%   /
devfs          201Ki  201Ki    0Bi   100%      694                   0  100%   /dev
/dev/disk1s4   234Gi  9.0Gi   10Gi    47%        9 9223372036854775798    0%   /private/var/vm
map -hosts       0Bi    0Bi    0Bi   100%        0                   0  100%   /net
map auto_home    0Bi    0Bi    0Bi   100%        0                   0  100%   /home
/dev/disk2s2   1.2Ti  541Gi  670Gi    45%   717710          4294249569    0%   /Volumes/Data
/dev/disk2s3   652Gi  596Gi   56Gi    92% 14590313          4280376966    0%   /Volumes/Time Machine

The -h formats the sizes into human readable units such as 234Gi for gigabytes.