In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to share with you the relevant knowledge points about the differences between Linux's du and df commands, which are detailed in content and clear in logic. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
1. Linux df command df command is used to check the disk space on the disk partition, including how much is used and how much is left. The default unit is KB.
Such as the following command:
The execution result of df-h is as follows:
The meaning of each column of the result of the execution:
The first column Filesystem, disk partition second column Size, disk partition size third column Used, used space fourth column Avail, free space fifth column Use%, percentage used sixth column Mounted on, mount point 1234567891011 explain the following h parameter, h is to change the displayed units to easily recognizable units, is no longer the default KB.
Instructions for using all the parameters of the df command are attached below:
-an or-- all: contains all file systems;-- block-size=: displays the number of chunks in a specified chunk size;-h or-- human-readable: displays information in a more readable manner;-H or-- si: same as the-h parameter, but is calculated in 1000 Bytes conversion units instead of 1024 Bytes;-I or-- inodes: displays inode information -k or-- kilobytes: specify a chunk size of 1024 bytes;-l or-- local: display only file systems on the local side;-m or-- megabytes: specify a chunk size of 1048576 bytes;-- no-sync: do not execute the sync instruction before getting disk usage information, which is the default value; 1234567892. The Linux du command du is used to view file and directory sizes, which is slightly different from df.
1. For example, to see the total size of the / data directory, you can use the following command:
The execution result of du-sh / data is as follows:
Or go to the / data directory and execute it directly:
The execution result of du-sh is as follows:
The-s parameter is to view the total size (as opposed to looking at the size of each directory), and the-h parameter is to change the default unit KB to a more recognizable unit.
two。 If you want to see the size of each subdirectory under the / data directory, including the subdirectories of the subdirectory, but not the files under / data, you can use the following command:
The execution result of du-h is as follows:
Note: this command does not contain the file size in the / data directory
3. If you want to see the size of each subdirectory under the / data directory, including the subdirectories of the subdirectory, and include the files under / data, you can use the following command:
The execution result of du-h * is as follows:
4. To see the size of each subdirectory under the / data directory, excluding the subdirectories of the subdirectory, you can use the following command:
The execution result of du-sh * is as follows:
5. To see the size of each subdirectory and file under the / data directory, you need to use the-a parameter:
The result of the du-ah command is as follows:
Instructions for the parameters of the du command are attached below:
-an or-all displays the size of individual files in the directory. -b or-bytes displays the directory or file size in byte. -c or-- total displays not only the size of individual directories or files, but also the sum of all directories or files. -k or-- kilobytes output in KB (1024bytes). -m or-- megabytes output in MB. -s or-- summarize displays only the total and lists only the last plus value. -h or-- human-readable is in the unit of KMagazine GetWord ("G"); to improve the readability of information. -x or-- one-file-xystem is based on the file system at the beginning of the processing, and will be skipped in case of other different file system directories. The source file size of the symbolic link specified in-L or-- dereference display options. When-S or-- separate-dirs displays the size of an individual directory, it does not include the size of its subdirectories. -X or-- exclude-from= above the specified directory or file is all the contents of this article entitled "what are the differences between Linux's du and df commands?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.