• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

df Command Examples in Linux

by admin

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.

Note: Remember that the Linux system always has processes that handle files running in the background. The values from the df command reflect what the Linux system thinks are the current values at that point in time. It’s possible that you have a process running that has created or deleted a file but has not released the file yet. This value is not included in the free space calculation.

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

Filed Under: Linux

Some more articles you might also be interested in …

  1. RedHat / CentOS : How to change currently active slave interface of bonding online
  2. CentOS / RHEL 7 : How to Modify GRUB2 Arguments with grubby
  3. printf: command not found
  4. How to find and delete files older than some particular time period in Linux
  5. hostnamectl Command Examples in Linux
  6. macof: command not found
  7. How to Enable Password Aging in Linux with NIS
  8. logname Command Examples in Linux
  9. RHEL 7 – RHCSA Notes – System documentation including man, info, and files in /usr/share/doc
  10. Basic Commands to Troubleshoot Performance Issues in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright