• 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. how to rotate Tang Server Keys and update the Clevis Client
  2. How To Create A SSH Banner in CentOS/RHEL Server
  3. Managing MySQL Using Systemd As A Non Root User
  4. Beginners Guide to DHCP – Install and configure DHCP server and client
  5. How to Disable the ‘lvm2-lvmetad.socket/service’ on CentOS/RHEL 7
  6. CIFS Share Filesystem Is Not Mounted after Reboot on CentOS/RHEL 7
  7. Manage ASM Audit Files with syslog – configure lograte and auditing
  8. How to configure DM-Multipath from an iSCSI initiator to an iSCSI target in CentOS / RHEL
  9. How to Find Filesystem Inode Utilization in Linux
  10. How to Change the Network Bonding Mode in CentOS/RHEL 6

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright