Bash Command to Check Disk Space


If you want to check how much disk space you have on your device using the Terminal running bash shell, you can do that using the df command.


Example:

bash-3.2$ df -h

Filesystem        Size    Used   Avail Capacity iused ifree %iused  Mounted on
/dev/disk3s3s1   228Gi    13Gi   102Gi    12%    381k  1.1G    0%   /
devfs            200Ki   200Ki     0Bi   100%     693     0  100%   /dev
/dev/disk3s6     228Gi   3.0Gi   102Gi     3%       3  1.1G    0%   /System/Volumes/VM
/dev/disk3s4     228Gi    10Gi   102Gi    10%     687  1.1G    0%   /System/Volumes/Preboot
/dev/disk3s2     228Gi   725Mi   102Gi     1%     308  1.1G    0%   /System/Volumes/Update
/dev/disk2s2     500Mi   6.0Mi   482Mi     2%       7  4.9M    0%   /System/Volumes/xarts
/dev/disk2s1     500Mi   6.1Mi   482Mi     2%      33  4.9M    0%   /System/Volumes/iSCPreboot
/dev/disk2s3     500Mi   864Ki   482Mi     1%      40  4.9M    0%   /System/Volumes/Hardware
/dev/disk3s1     228Gi    98Gi   102Gi    50%    805k  1.1G    0%   /System/Volumes/Data
map auto_home      0Bi     0Bi     0Bi   100%       0     0     -   /System/Volumes/Data/home
/dev/disk1s1     5.0Gi   1.5Gi   3.5Gi    31%      58   36M    0%   /System/Volumes/Update/SFR/mnt1
/dev/disk3s3     228Gi    13Gi   102Gi    12%    382k  1.1G    0%   /System/Volumes/Update/mnt1

The -h flag is used to make the output human-readable.

If you want to know the disk space used by a particular system you can do that as follows,

Example:
$ df -h devfs
Filesystem    Size    Used   Avail Capacity iused ifree %iused  Mounted on
devfs        200Ki   200Ki     0Bi   100%     693     0  100%   /dev
Find disk space df command in bash shell example

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap