Linux: Find Out How Much Disk Space Left On Hard Drive

The basic syntax is as follows:

df
df /path/to/dev
df [options]
df [options] /path/to/dev

Examples

Type the following command:
# df
# df -H

Sample outputs:

Fig.01: df command in action

Fig.01: df command in action

The following example will provide information only for the partition/device that contains the /home directory:
# df /home
# df -h /home

To see inode usage instead of block usage, type:
# df -i
# df -i /
# df -ih /
# df -i /dev/md0

Sample outputs:

Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/md0             7872512   35813 7836699    1% /

Pass the -T to find out file system type:
# df -T -h
Sample outputs:

Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/md0      ext4    119G  1.8G  111G   2% /
tmpfs        tmpfs   1002M     0 1002M   0% /lib/init/rw
udev         tmpfs   1000M  260K 1000M   1% /dev
tmpfs        tmpfs   1002M     0 1002M   0% /dev/shm
/dev/md2      ext4    1.5T  658G  745G  47% /data
/dev/mapper/cryptvg-mybackup
              ext3    591G   78G  484G  14% /securebackup
df command options

From the df command man page:

  -a, --all             include dummy file systems
  -B, --block-size=SIZE  use SIZE-byte blocks
      --total           produce a grand total
  -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
  -k                    like --block-size=1K
  -l, --local           limit listing to local file systems
      --no-sync         do not invoke sync before getting usage info (default)
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
  -t, --type=TYPE       limit listing to file systems of type TYPE
  -T, --print-type      print file system type
  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE

Original Post: [http://www.cyberciti.biz/faq/linux-command-space-left-on-hard-disk-drive/]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s