In Linux, you will often see the file size, which is usually used by the command du:
The command is explained in detail below:
[Email protected] logs]$ du--help
Usage: du [options] ... [File] ...
Or: du [options] ...--files0-from=f
Calculate the disk usage for each file, and the directory will take the total amount.
The long option must use parameters that are also required for short options.
-A,--all the disk usage of all files, not just the directory
--apparent-size displays surface dosage, not disk usage, although surface dosage is usually
Smaller, but sometimes it can be because of the "hole" between sparse files, internal broken
Not directly referenced blocks, and other reasons.
-B,--block-size= size block with specified number of bytes
-C,--total display total information
-D,--dereference-args remove symbolic connections listed on the command line
--files0-from=f the file name that ends with NUL in the computed files F corresponds to the disk space occupied
If the value of F is "-", the file name is read from the standard input
-H equals--dereference-args (-D)
-H,--human-readable display dimensions in a more readable manner (e.g. 1K 234M 2G)
--si is similar to-H, but uses 1000 as the base instead of 1024 when calculating
-L,--count-links if it is a hard connection, calculate its dimensions multiple times
-L,--dereference find out the true destination of any symbolic link indication
-P,--no-dereference does not follow any symbolic link (default)
-0,--null each blank line as 0 bytes instead of line break
-S,--separate-dirs does not include the amount of sub-directories
-S,--summarize only calculates the total amount of each parameter in the command column separately
-X,--one-file-system skips directories on different file systems
-X,--exclude-from= file excludes files that match the pattern described in the specified file
--exclude=pattern exclude files that match the patterns described in pattern
--max-depth=n Show catalog totals (use calculation files with--all)
When n is the specified value, the calculation depth is n;
--time Displays the last modified time for all files in the directory or subdirectory
--time=word Displays the WORD time, not the modified time:
Atime,access,use,ctime or Status
The--time-style= style displays the time in the specified style (the style interpretation rule is the same as the "date" command):
--HELP Display this help message and exit
--version display version information and exit
The values shown are from--block-size, Du_block_size, block_size
And BLOCKSIZE the first available SIZE unit in the environment variable.
Otherwise, the default unit is 1024 bytes (or 512 if Posixly_correct is set).
The SIZE can be an optional integer followed by one of the following units:
KB 1000,k 1024,mb 1000*1000,m 1024*1024, also G, T, P, E, Z, Y.
Please report du's error to [email protected]
GNU coreutils Project Home:
GNU Software general help:
Please report du's translation errors to
To get the complete documentation, run: info coreutils ' du invocation '
According to the above parameters, the most common use is-H and--max-depth-n, the use of the following:
[Email protected] logs]$ du-h php101
[Email protected] logs]$ du-h php111
[Email protected] logs]$
If you want to look further, you can use the parameter--max-depth=n
For example, to see the size of the next-level directory (medium file) in each directory under the current directory, at which point n=2
[Email protected] logs]$ du-h--max-depth=2.
If you want to continue to view the next level of directory, n=3
[Email protected] logs]$ du-h--max-depth=3.
Change the value of N to see the size of the directory hierarchy. Then go to the catalogue and use Du-ah./view the size of the file in the current directory
[Email protected] huhoo-api]$ Du-ah.
The other parameters can be interpreted in turn, and this is only the--max-depth=n, which is often used to find which files occupy disk space at a higher frequency.
This article from "Flat Light is true" blog, please be sure to keep this source http://ucode.blog.51cto.com/10837891/1769003
View file size and directory size under Linux and the size of files in the directory