Sometimes you need to see how much disk space is available on an individual device. The df command allows you to easily see what’s happening on all the mounted disks:
$ df -h Filesystem Size Used Avail Capacity iused ifree %iused Mounted on /dev/disk1s5s1 113Gi 15Gi 37Gi 29% 577263 385625880 0% / devfs 189Ki 189Ki 0Bi 100% 652 0 100% /dev /dev/disk1s4 113Gi 4.0Gi 37Gi 10% 5 385625880 0% /System/Volumes/VM /dev/disk1s2 113Gi 386Mi 37Gi 2% 1874 385625880 0% /System/Volumes/Preboot /dev/disk1s6 113Gi 4.1Mi 37Gi 1% 17 385625880 0% /System/Volumes/Update /dev/disk1s1 113Gi 56Gi 37Gi 61% 1053114 385625880 0% /System/Volumes/Data map auto_home 0Bi 0Bi 0Bi 100% 0 0 100% /System/Volumes/Data/home
A few different command-line parameters are available with the df command, most of which you’ll never use. One popular parameter is -h, which shows the disk space in human-readable form, usually as an M for megabytes or a G for gigabytes. Now instead of having to decode those ugly block numbers, all of the disk sizes are shown using “normal” sizes. The df command is invaluable in troubleshooting disk space problems on the system.
df Command Examples
1. To to get the file system usage in human readable format:
# df -h
2. To get the file system usage for all the file systems including dummies:
# df -a
3. To get the file system usage in specified block size:
# df -B=1024 # df --block-size=1024
4. To get the usage for a file instead of a mount point:
# df --direct
5. To get the grant total:
# df --total
6. To get the usage in powers of 1000 instead of 1024:
# df -H
7. To get the inode information instead of block usage:
# df -i
8. To get the usage as 1k block (i.e. –block-size=1K):
# df -k
9. To get the file system usage for local file systems:
# df -l # df --local
10. Do not invoke sync before getting usage info:
# df --no-sync
11. To get the o/p in POSIX format:
# df -P # df --portability
12. To invoke sync before getting usage info:
# df --sync
13. To limit listing to file systems of type TYPE:
# df -t=ext3 # df --type=ext3
14. To print file system type:
# df -T # df --print-type
15. To limit listing to file systems not of type TYPE:
# df -x=ext2 # df --exclude-type=ext2
16. To get the version information of the file system:
# df --version