Detailed analysis of how to use the Linux df command

Source: Internet
Author: User

The Linux df command is a simple command for an application that learns Linux management. However, simple commands sometimes help us a lot. Here we will introduce in detail how to use the Linux df command.

Detailed df command usage
A: displays the disk usage of all file systems and partitions.
I: displays the I-nodes usage.
K: The size is represented by k (default)
T: displays the disk usage of all partitions in a file system.
X: displays the disk usage of all partitions of a file system.
T: displays the file system name of each partition.
Common commands: df-hi

Operation Details
Reference
The command df can display the maximum available space and usage of all file systems. See the following example:
# Df-h
Filesystem Size Used Avail Capacity Mounted on
/Dev/ad0s1a 1.9G 389 M 1.4G 21%/
Devfs 1.0 K 1.0 K 0B 100%/dev
/Dev/ad0s1d 989 M 54 K 910 M 0%/tmp
/Dev/ad0s1f 4.8G 3.8G 657 M 86%/usr
/Dev/ad0s1e 1.9G 149 M 1.6G 8%/var
/Dev/ad0s1g 26G 890 K 24G 0%/volume2
/Dev/da0s1d 325G 261G 38G 87%/volume1

The-h parameter is added to indicate that the "Human-readable" output is used, that is, the file system uses readable formats such as GB and MB.
The first and last fields output by the preceding command are the File System and Its mount point. We can see that the/dev/ad0s1a partition is mounted under the root directory. We mentioned in the previous section that ad represents the IDE hard disk, while s1 represents the first primary sector. I have another SCSI hard disk named da, which has a large capacity and is mainly used to store data. Devfs is a special file system. It is not a real disk, but a Virtual File System that FreeBSD uses to manage system hardware devices.
The following four fields, Size, Used, Avail, and Capacity, are the Capacity, Used Size, remaining Size, and percentage of the shard. When the hard disk capacity is full, you may see that the percentage used exceeds 100%, because FreeBSD will leave some space for the root, so that when the root file system is full, you can also write something to the file system for management.
In addition, we can also use parameter-I to view the current inode usage of the file system. Sometimes, although the file system still has space, if there is not enough inode to store the file information, it will not be able to add new files.
# Df-ih
Filesystem Size Used Avail Capacity iused ifree % iused Mounted on
/Dev/ad0s1a 1.9G 389 M 1.4G 21% 20495 262127/
Devfs 1.0 K 1.0 K 0B 100% 0 0 100%/dev
/Dev/ad0s1d 989 M 62 K 910 M 0% 24 141286 0%/tmp
/Dev/ad0s1f 4.8G 3.8G 657 M 86% 311439 348015/usr
/Dev/ad0s1e 1.9G 149 M 1.6G 8% 1758 280864/var
/Dev/ad0s1g 26G 890 K 24G 0% 12 3532786 0%/volume2
/Dev/da0s1d 325G 261G 38G 87% 707277 43311409/volume1
We can see that the number of inode used in the root directory is 20495, and there are 262127 available inode.

This explains how to use and operate the Linux df command.

Tips
Do you still remember what inode is? Inode is the basic information (metadata) used to store archives and directories, including the time, file name, user, and group. When dividing a sector, the system will first make a bunch of inode for later use. The number of inode is related to the total number of files and directories that can be created in the system. If most of the files to be stored are small, there will be a large number of files on hard disks of the same size, that is, a large number of inode are required to mount files and directories.

  1. Differences between Linux and Unix
  2. Detailed analysis of Linux Firewall Configuration
  3. Detailed analysis of Linux folder execution Permissions
  4. How to check Linux Security Vulnerabilities
  5. Detailed analysis of Linux Server Memory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.