Linux Command details df check disk space usage of the file system, linuxdf

Source: Internet
Author: User
Tags disk usage inode usage

Linux Command details df check disk space usage of the file system, linuxdf


Command: df

Check disk space usage of the file system
You can view the total capacity, usage, remaining space, and mount location of all mounted disks.

Syntax: # df [OPTION] [FILE]
FILE is an optional list of one or more path names. If this option is selected, the disk usage of the FILE system where the FILE is located is displayed.

Ps:
1: All Users have the permission to use the df command.
2: disk space is displayed in 1KB by default.
3: by default, the available space of all mounted file systems is displayed.
4: When a super permission user uses the df command, the capacity of a partition will exceed 100%. The reason is as follows:
Linux saves 10% of the space for Super Users. In this way, when the disk capacity is close to 100%, the system administrator can still work normally.


Parameters: 

-a: display disk usage of all file systems (including 0 block file system, such as / proc file system)
-B: Used to specify the practical unit of the report (default block size is 1KB)
-h: Display the file system size in appropriate units (KB, MB, GB) for easy reading
-H: Like "-h", display the file system size in appropriate units (KB, MB, GB), but use 1000 for capacity conversion
-i: display inode inode usage, not disk blocks
-k: The block displays the disk space usage in KB (1024 bytes) (default unit)
-l: only display the disk space usage of the local file system
-m: display in MB
-P: Use POSIX output format
-t: display the disk space usage of the specified type of file system
-T: display file system type (such as ext4)
-x: display disk space usage of file systems that are not of the specified type (as opposed to the t option)
--help: display help information
--total: display total
--sync: execute the sync command before obtaining the disk information
--no-sync: ignore the sync command
--version: display version information

Ps:
1. The default is to display by k
2. Without any parameters, users will get free space for each mounted device on the local system


Detailed explanation of df command display content
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/ dev / sda2 9071088 1030988 7579300 12% /
tmpfs 957244 0 957244 0% / dev / shm
/ dev / sda1 198337 26817 161280 15% / boot
/ dev / sda5 9351388 151940 8724416 2% / main
Filesystem: Specify the name of the file system, which can also be understood as the path name of the device file corresponding to the file system
1K-blocks: the number of data blocks (1024 bytes) contained in the specified file system
Used: the number of used data blocks
Available: the number of available data blocks
Use%: percentage of space used
Mounted on: the mount point of the specified file system

Ps: When ordinary users use this command, Used + Available <1K-blocks, because by default each partition leaves a small amount of space for system administrator


Examples:
1. Display disk usage in a more readable way
# df -h
Filesystem Size Used Avail Use% Mounted on
/ dev / sda2 8.7G 1007M 7.3G 12% /
tmpfs 935M 0 935M 0% / dev / shm
/ dev / sda1 194M 27M 158M 15% / boot
/ dev / sda5 9.0G 149M 8.4G 2% / doiido

2. Display all the partitions of the system
# df -a
Filesystem 1K-blocks Used Available Use% Mounted on
/ dev / sda2 9071088 1030988 7579300 12% /
proc 0 0 0-/ proc
sysfs 0 0 0-/ sys
devpts 0 0 0-/ dev / pts
tmpfs 957244 0 957244 0% / dev / shm
/ dev / sda1 198337 26817 161280 15% / boot
/ dev / sda5 9351388 151940 8724416 2% / doiido
none 0 0 0-/ proc / sys / fs / binfmt_misc

3. Display inode index node usage
Sometimes the file system still has space, but there is not enough inodes, so it is impossible to add files
# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/ dev / sda2 577088 32829 544259 6% /
tmpfs 239311 1 239310 1% / dev / shm
/ dev / sda1 51200 38 51162 1% / boot
/ dev / sda5 594512 11 594501 1% / doiido

4. Display disk usage in k
# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/ dev / sda2 9071088 1030992 7579296 12% /
tmpfs 957244 0 957244 0% / dev / shm
/ dev / sda1 198337 26817 161280 15% / boot
/ dev / sda5 9351388 151940 8724416 2% / doiido

5. Display the type of file system.
# df -T
Filesystem Type 1K-blocks Used Available Use% Mounted on
/ dev / sda2 ext4 9071088 1030992 7579296 12% /
tmpfs tmpfs 957244 0 957244 0% / dev / shm
/ dev / sda1 ext4 198337 26817 161280 15% / boot
/ dev / sda5 ext4 9351388 151940 8724416 2% / doiido

6. Display the specified type of disk
# df -t ext4
Filesystem 1K-blocks Used Available Use% Mounted on
/ dev / sda2 9071088 1030992 7579296 12% /
/ dev / sda1 198337 26817 161280 15% / boot
/ dev / sda5 9351388 151940 8724416 2% / doiido

7. Display disk usage in MB
# df -Bm
Filesystem 1M-blocks Used Available Use% Mounted on
/ dev / sda2 8859M 1007M 7402M 12% /
tmpfs 935M 0M 935M 0% / dev / shm
/ dev / sda1 194M 27M 158M 15% / boot
/ dev / sda5 9133M 149M 8520M 2% / doiido


The same applies to # df -m, except that no unit will be added after the number, as shown below

Filesystem 1M-blocks Used Available Use% Mounted on
/ dev / sda2 8859 1007 7402 12% /
tmpfs 935 0 935 0% / dev / shm
/ dev / sda1 194 27 158 15% / boot
/ dev / sda5 9133 149 8520 2% / doiido

8. Display total usage
# df --total
Filesystem 1K-blocks Used Available Use% Mounted on
/ dev / sda2 9071088 1030992 7579296 12% /
tmpfs 957244 0 957244 0% / dev / shm
/ dev / sda1 198337 26817 161280 15% / boot
/ dev / sda5 9351388 151940 8724416 2% / doiido
total 19578057 1209749 17422236 7%

9. Get the usage of the file system through the file
9.1: # df / doiido
Filesystem 1K-blocks Used Available Use% Mounted on
/ dev / sda5 9351388 151940 8724416 2% / doiido

9.2:

# cd / doiido

# df dodo
Filesystem 1K-blocks Used Available Use% Mounted on
/ dev / sda5 9351388 151940 8724416 2% / doiido


Here you will find that if you use df for a directory or file in the same file system, you will enter the disk usage in the file system

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.