😎
CS1.dev
  • Welcome to Computer Science 1
  • Unit 2
    • Activity 2.1
    • Activity 2.2
    • Activity 2.3
    • Activity 2.4
    • Activity 2.5
    • Activity 2.6
    • Activity 2.7
    • Activity 2.9
    • Activity 2.10
    • Project 2
    • Activity 2.8
    • Activity 2.11
    • Activity 2.12
    • Activity 2.13
    • Activity 2.14
    • Activity 2.15
    • Activity 2.16
    • Activity 2.17
    • Activity 2.18
    • Activity 2.19
    • Project 3
    • Activity 2.20
    • Activity 2.21
    • Activity 2.22
    • Activity 2.23
    • Activity 2.24
    • Project 4
    • Activity 2.25
    • Activity 2.26
    • Activity 2.27
    • Activity 2.28
    • Project 5
    • Activity 2.29
    • Activity 2.30
    • Activity 2.31
    • Activity 2.32
    • Activity 2.33
    • Activity 2.34
    • Activity 2.35
    • Activity 2.36
  • Unit 3
    • Activity 3.1
    • Activity 3.2
    • Activity 3.3
    • Activity 3.4
    • Activity 3.5
    • Activity 3.6
    • Activity 3.7
    • Activity 3.8
    • Activity 3.9
    • Activity 3.10
    • Activity 3.11
    • Project 6
    • Activity 3.12
  • Activity 3.13
  • Activity 3.14
  • Activity 3.15
  • Activity 3.16
  • Project 7
  • Activity 3.17
  • Activity 3.18
  • Activity 3.19
  • Project 8
  • Linux
    • bash
    • cat
    • cd
    • chmod
    • df
    • echo
    • find
    • grep
    • less
    • ls
    • mkdir
    • more
    • pwd
    • tar
    • touch
    • unzip
    • zip
Powered by GitBook
On this page
  1. Linux

df

The df command in Linux stands for "disk free" and is used to display information about the file system disk space usage. It provides an overview of the total, used, and available space on all mounted filesystems or on a specific filesystem if specified. Here's an overview of the df command and its functionalities:

  1. Basic Usage: When you run df without any options, it displays the disk space usage of all currently mounted filesystems. The information typically includes the filesystem name, size, used space, available space, the percentage of space used, and the mount point.

  2. Human-Readable Format: The -h (human-readable) option makes the output easier to understand by displaying sizes in KB, MB, GB, etc., instead of blocks. For example, df -h will show the disk usage in a format like "1.5G" instead of "1572864".

  3. Specific Filesystem: You can specify a particular filesystem to check its disk usage. For example, df /dev/sda1 shows the disk usage of the /dev/sda1 filesystem.

  4. Inode Information: The -i option displays inode information instead of block usage. This is useful for checking inode usage, as running out of inodes means you can't create more files, even if there's disk space available.

  5. Type of Filesystem: The -T option includes the type of each filesystem in the output. For instance, df -T might show types like ext4, tmpfs, etc.

  6. Exclude Filesystem Type: Using the -x option followed by a filesystem type, you can exclude specific types of filesystems from the output. For example, df -x tmpfs excludes all tmpfs filesystems from the report.

  7. Network File Systems: df also reports on network file systems like NFS if they are mounted, which can be useful in networked environments or with network-attached storage.

  8. Local Filesystems Only: The -l option restricts the output to local filesystems only, omitting network filesystems and other non-local types.

  9. Usage in Scripts: df is frequently used in shell scripts, for monitoring disk usage, generating alerts, or for other system administration tasks.

PreviouschmodNextecho

Last updated 1 year ago