Disk Usage Using the DF command

From TheLinuxVault

Jump to: navigation, search

Sometimes, you may need to find the exact amount of disk usage for individual disks. This can be cumbersome using a file manager, but there is a great command line utility to help you do it.

To use this command, the syntax is as follows:

df (-a -B -h -H -i -k -l -P -t -T) [device]

There are lots of different options for this command:

-a Lists all of the filesystems, even "dummy" filesystems

-B Define the block size (expert option)

-h Print the size in a human readable format

-H Print the size in the SI format

-i Define the inode size (expert option)

-k Define block size as 1K (expert option)

-l Only view local filesystems

-P Use the POSIX output format

-t Only list certain filesystem types

-T Print the filesystem type

Contents

[edit] Examples

[edit] List all filesystems

df

This will output all filesystems, their total size, total used space, total available space, and mount point.

[edit] List only local filesystems

df -l

This will ouput only local filesystems.

[edit] Use a human readable size format

df -h

This will output all filesystems, with their size formatted in kilobytes, megabytes, gigabytes, etc.

[edit] Use the SI size format

df -H

This will output all filesystems, with their size formatted in kibibytes, mibibytes, gibibytes, etc.

[edit] Print the filesystem type

df -T

This will output all filesystems, as well as their type

[edit] Limit the filesystem type

df -t ext3

This will output all filesystems that are in the ext3 format

[edit] Select a certain device

df /dev/hda1

This will output the information for the device "/dev/hda1"

[edit] Putting it all together

Now that we've seen a whole bunch of different options, here are a few common, useful examples:

df -h -l

This will list all local filesystems in human readable format

df -h -T

This will list all filesystems, their types, and their size in a human readable format

Personal tools