Monday, July 29, 2013

How to see disk space usage in linux

Sometimes we need to know the hard drive usage statistics.
In Linux we can use df command to find out how much disk space is used.

df command will show you Used and available space, File system mount point, File systen capacity, The number of inodes available,

The basic usage is follow:

df [options]

df [options] /path_to_dev

Example

df

df -h

The following command will show information only for the /home directory partiton

df /home

df -h /home

use Option -T to see file system type

df -T


Below is the list for df command options

  -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