du -ah --max-depth = 1 this is what I want results indicate a directory display all files and folders (and sub-folders), h expressed in human can understand manner, max-depth representing the directory depth.
du command to display a directory or file size of disk space occupied. Common combinations of options as: du -sh
一、du的功能:`du` reports the amount of disk space used by the specified files and for each subdirectory (of directory arguments). with no arguments,`du` reports the disk space for the current directory。
Obviously, with different df, which is used to view the size of files or directories take up more disk space.
Two, du commonly used options:
-h: displays a human-readable manner
-a: Displays the directory of disk space occupied, but also to show its directory and files take up disk space size
-s: display disk space occupied by the directory, do not display the size of its disk space occupied by files and subdirectories
-c: display disk space occupied by several directories or files, but also the sum of their statistics
--apparent-size: Display files or their size
-l: Statistical hard disk space size occupied Links
-L: Statistics symbolic link points to files take up disk space
A, du -h: this is not to say.
Two, du -a: Use this option to display the subdirectories and files take up disk space, directory size and directory.
As can be seen, by default, only shows the size of the download directory du disk space occupied, but after using the -a option, which not only shows the directory (last line), but also shows the various files take up disk space, directory size.
Three, du -s: When using this option, du displays only the size of the disk space occupied by the directory, without displaying the information at its subdirectories and files take up disk space.
By default, du directory does not display files take up disk space information, but it will display information about its subdirectories take up disk space; and later use the -s option, only xx amount of disk space occupied by directories.
Four, du --apparent-size: the size of the file or directory itself, rather than the disk space they occupy. The size of the file or directory disk space occupied size itself is not entirely consistent with their sometimes; this phenomenon unique to non-linux, windows inside as well. We see the help documentation to explain this option: The apparent size of a file is the number of bytes reported by `wc -c` regular files, or more generally,` ls -l -block-size = 1` or `stat - format =% s`.For example, a file containing the word `zoo` with no newline would, of course, have an apparent size of 3. Such a small file may require anywhere from 0 to 16 kib or more of disk space, depending on the type and configuration of the file system on which the file resides.
This passage gives the difference between the size of the file or directory itself and take up disk space size. He cited the example below a more exaggerated, here is not to write about the. We know: wc or ls --block-size shows the size of its own, while du is given by the size of the amount of disk space.
Five, du -c: When using this option, not only shows a few occupied by each file or directory size disk space, but also the sum of their statistics.
As shown, together with the -c option, du not only display two directories respective amount of disk space occupied, they are also the last line of statistical sum.
Six, du -l: This option is mainly for hard links. When statistical directory disk space occupied, -l option hard links will also come in statistics. Help documentation is explained: Count the size of all files, even if they have appeared already (as a hard link).
We establish a hard link in the download directory, point to a file in the catalog. When not in use the -l option, du find hard links to files in this directory, then automatically ignore the link file in order to avoid double-counting; -l option, du will put the hard-linked files also come in statistics.
Seven, du -L: This option is mainly for symbolic links. It would symbolic link points to a file size of disk space occupied statistics also come. Help documentation is explained this way: Dereference symbolic links (show the disk space used by the file or directory that the link points to instead of the space used by the link).
We create a symbolic link in the download directory, point to a file in the catalog. We see the result of the operation shown in the picture above, when using the -L option, du will symbolic link points to the size of the file to the directory where the statistics come.
In addition, we see the results du -lh of the du -h same as if there were no statistics of the size of the symbolic link; in fact not the case. From the practical point of view, the symbolic link itself does not seem to take up disk space, so it appears the situation.
Finally, du command in the directory disk space occupied statistics, statistical link does not default file (either a hard link or a symbolic link), so use the -l and -L options specifically point out; in addition, du command does not display the default directory information files take up disk space, but the default display information about disk space occupied by its subdirectories. Guaizai.
du -sh: View the current directory accounted for a total capacity. Without listing each child occupied capacity alone
du -lh --max-depth=1 : 查看当前目录下一级子文件和子目录占用的磁盘容量。