cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

os:linux:command:df.html



Linux Commands Cheat Sheet

df - How to use df command in Linux

df command options

# df --help
  -B, --block-size=SIZE  scale sizes by SIZE before printing them; e.g.,
                           '-BM' prints sizes in units of 1,048,576 bytes;
                           see SIZE format below
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si              likewise, but use powers of 1000 not 1024
  -i, --inodes          list inode information instead of block usage
  -T, --print-type      print file system type

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).
# man df
NAME
       df - report file system disk space usage

SYNOPSIS
       df [OPTION]... [FILE]...

DESCRIPTION
df displays the amount of disk space available on the file system containing each file name argument. 

OPTIONS
       -h, --human-readable
              print sizes in human readable format (e.g., 1K 234M 2G)

       -B, --block-size=SIZE
              scale  sizes by SIZE before printing them; e.g., '-BM' prints sizes in units of 1,048,576 bytes; see SIZE
              format below
       SIZE  is  an integer and optional unit (example: 10M is 10*1024*1024).  Units are K, M, G, T, P, E, Z, Y (powers
       of 1024) or KB, MB, ... (powers of 1000).

Example

-h

# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  6.7G 1023M  5.7G  15% /
devtmpfs                 362M     0  362M   0% /dev
tmpfs                    371M     0  371M   0% /dev/shm
tmpfs                    371M  5.0M  366M   2% /run
tmpfs                    371M     0  371M   0% /sys/fs/cgroup
/dev/sda1                497M  119M  379M  24% /boot

-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)


-m

$ df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/sda2                 8670      2699      5524  33% /
/dev/sda1                  289        17       258   6% /boot
tmpfs                      248         0       248   0% /dev/shm


-B

$ df -BG
Filesystem           1G-blocks      Used Available Use% Mounted on
/dev/sda2                   9G        3G        6G  33% /
/dev/sda1                   1G        1G        1G   6% /boot
tmpfs                       1G        0G        1G   0% /dev/shm
$ df -BM
Filesystem           1M-blocks      Used Available Use% Mounted on
/dev/sda2                8670M     2699M     5524M  33% /
/dev/sda1                 289M       17M      258M   6% /boot
tmpfs                     248M        0M      248M   0% /dev/shm
$ df -BT
Filesystem           1T-blocks      Used Available Use% Mounted on
/dev/sda2                   1T        1T        1T  33% /
/dev/sda1                   1T        1T        1T   6% /boot
tmpfs                       1T        0T        1T   0% /dev/shm


df -h vs df -H

[root@centos7 ~]# df -hT   
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs       6.7G  2.8G  3.9G  43% /
devtmpfs                devtmpfs  362M     0  362M   0% /dev
tmpfs                   tmpfs     371M     0  371M   0% /dev/shm
tmpfs                   tmpfs     371M  5.0M  366M   2% /run
tmpfs                   tmpfs     371M     0  371M   0% /sys/fs/cgroup
/dev/sda1               xfs       497M  119M  379M  24% /boot
tmpfs                   tmpfs      75M     0   75M   0% /run/user/0
[root@centos7 ~]#

-h, --human-readable print sizes in human readable format (e.g., 1K 234M 2G)

[root@centos7 ~]# df -HT
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/mapper/centos-root xfs       7.2G  3.1G  4.2G  43% /
devtmpfs                devtmpfs  379M     0  379M   0% /dev
tmpfs                   tmpfs     389M     0  389M   0% /dev/shm
tmpfs                   tmpfs     389M  5.3M  384M   2% /run
tmpfs                   tmpfs     389M     0  389M   0% /sys/fs/cgroup
/dev/sda1               xfs       521M  125M  397M  24% /boot
tmpfs                   tmpfs      78M     0   78M   0% /run/user/0
[root@centos7 ~]#

-H, --si likewise, but use powers of 1000 not 1024




os/linux/command/df.html.txt ยท Last modified: 2017/05/14 by admin

Page Tools