Home >Operation and Maintenance >Linux Operation and Maintenance >What is the command to check disk space in Linux?

What is the command to check disk space in Linux?

青灯夜游
青灯夜游Original
2019-06-05 11:53:5436490browse

Nowadays, many technical personnel like to use Linux system website servers. Using Linux system is more secure and efficient, but the capacity of our website server itself is certain, so we need to check the usage of Linux disk space. The following is This article will introduce to you how to check disk space in Linux. I hope it will be helpful to you.

What is the command to check disk space in Linux?

#In Linux, you can use the df command to view disk space. The df command can be used to check the disk space usage in the Linux file system, that is, the disk usage. (Recommended learning: linux video tutorial)

Grammar

df [选项]... [FILE]...

Command parameters:

● -a, --all Include all systems with 0 Blocks

● --block-size={SIZE} Use {SIZE} sized Blocks

● -h, --human -readable Use human readable format (the default value is not to add this option...)

● -H, --si is like -h, but uses 1000 as the unit instead of 1024

● -i, --inodes List inode information, do not list used blocks

● -k, --kilobytes Just like --block-size=1024

● -l, --local Limit the listed file structure

● -m, --megabytes Like --block-size=1048576

● --no-sync Get No sync before information (default)

● -P, --portability Use POSIX output format

●  --sync Sync before getting information

● -t , --type=TYPE Limit the TYPE of the listed file system

● -T, --print-type Display the form of the file system

● -x, --exclude-type=TYPE Restrict listing of file systems to do not show TYPE

● -v (ignore)

● --help Display this helper and exit

● --version Print version information and exit

How to use the df command to check disk space?

If used without any arguments, the df command will display information about all mounted file systems:

# df

Output:

Filesystem     1K-blocks      Used Available Use% Mounted on
dev              8172848         0   8172848   0% /dev
run              8218640      1696   8216944   1% /run
/dev/nvme0n1p3 222284728 183057872  27865672  87% /
tmpfs            8218640    150256   8068384   2% /dev/shm
/dev/nvme0n1p1    523248    107912    415336  21% /boot
/dev/sda1      480588496 172832632 283320260  38% /data

Each line includes information about the file system name (Filesystem), size (1K-blocks), used space (Used), available space (Available), used space percentage (Use%), and the directories within the file system. Mounted on.

By default, the df command displays disk space in units of 1 KB and displays the size of used disk space and available disk space in kilobytes. This is very inconvenient, How to display disk space usage in human readable format (megabytes and gigabytes)?

To view the information in human-readable format (megabytes and gigabytes), pass the following -h option:

# df -h

Output:

Filesystem     1K-blocks      Used Available Use% Mounted on
Filesystem      Size  Used Avail Use% Mounted on
dev             7.8G     0  7.8G   0% /dev
run             7.9G  1.8M  7.9G   1% /run
/dev/nvme0n1p3  212G  176G   27G  88% /
tmpfs           7.9G  145M  7.7G   2% /dev/shm
/dev/nvme0n1p1  511M  106M  406M  21% /boot
/dev/sda1       459G  165G  271G  38% /data

For more Linux-related technical knowledge, please visit the linux operation and maintenance column to learn!

The above is the detailed content of What is the command to check disk space in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:linux vi commandNext article:linux vi command