How to use df command in Linux / Unix {with examples}

The “df” command in Linux and Unix is used to display the amount of disk space used and available on the file system. The command can be used with various options to display the information in different formats. Some examples of how to use the “df” command are:

  1. To display information about all file systems in a human-readable format:
df -h
  1. To display information about a specific file system, for example the file system mounted at “/”:
df /
  1. To show inode information about file system
df -i
  1. To show information about all mounted filesystems of a specific type, for example ext4:
df -T ext4
  1. To show the total amount of disk space used by a directory and its subdirectories:
du -sh /path/to/directory
  1. To show the amount of disk space used by a specific file or directory:
du -sh /path/to/file or directory

It is important to note that the du command is used to show the disk usage of files and directories, while df command is used to show the disk usage of file systems.

Leave a Comment