Linux df command

The df command in Linux is used to display information about the disk space usage on file systems. It provides details about the total disk space, used space, available space, and the file system type for each mounted file system on the system.

Here’s an overview of how to use the df command:

  1. Basic Usage:
    To display the disk space usage on file systems, simply type df in your terminal. For example:
   df

This command will display information about the disk space usage on all mounted file systems.

  1. Displaying File System Usage:
    The df command will provide output indicating the disk space usage for each mounted file system. It typically displays the following information:
  • File system: The name or device associated with the file system.
  • Size: The total size of the file system.
  • Used: The amount of disk space used on the file system.
  • Available: The amount of disk space available on the file system.
  • Use%: The percentage of disk space used on the file system.
  • Mounted on: The mount point or directory where the file system is mounted.
  1. Examples:
  • Displaying disk space usage for all file systems: df This command will display information about the disk space usage for all mounted file systems on the system.
  • Checking disk space usage for a specific file system: df /dev/sda1 This command will display information about the disk space usage for the file system associated with /dev/sda1.
  • Displaying disk space usage in human-readable format: df -h This command will display the disk space usage in a human-readable format, showing sizes in units like kilobytes (K), megabytes (M), or gigabytes (G).
  • Checking disk space usage for a specific directory:
    df /home/user/documents
    This command will display information about the disk space usage for the file system containing the /home/user/documents directory.

The df command provides a quick overview of the disk space usage on file systems. It helps you monitor disk space usage, identify potential storage constraints, and determine the available space on mounted file systems.

For more information about the df command and its options, you can refer to the manual page by typing man df in your terminal.