diff --git a/pages.zh/common/du.md b/pages.zh/common/du.md new file mode 100644 index 0000000000..e5c82f8bd5 --- /dev/null +++ b/pages.zh/common/du.md @@ -0,0 +1,32 @@ +# du + +> 磁盘使用率:估计和汇总文件和目录空间使用率。 +> 更多信息:. + +- 以给定单位(B/KiB/MiB)列出目录和所有子目录的大小: + +`du -{{b|k|m}} {{路径/到/目录}}` + +- 以可读形式列出目录和任何子目录的大小(即自动转换为的合适的单位): + +`du -h {{路径/到/目录}}` + +- 以可读单位显示目录大小: + +`du -sh {{路径/到/目录}}` + +- 列出目录以及其中所有文件和目录的可读大小: + +`du -ah {{路径/到/目录}}` + +- 列出目录和任何子目录的可读大小,最多可达 N 级: + +`du -h --max-depth=N {{路径/到/目录}}` + +- 列出当前目录中所有 `.jpg` 文件的可读大小,并在最后显示累计总数: + +`du -ch {{./*.jpg}}` + +- 列出超过特定大小的所有文件和目录(包括隐藏的文件和目录)(对于查询实际占用空间很有用): + +`du --all --human-readable --threshold {{1G|1024M|1048576K}} .[^.]* *` diff --git a/pages/common/du.md b/pages/common/du.md index 1061c806ff..df5adcfa0b 100644 --- a/pages/common/du.md +++ b/pages/common/du.md @@ -23,9 +23,9 @@ `du -h --max-depth=N {{path/to/directory}}` -- List the human-readable size of all `.jpg` files in subdirectories of the current directory, and show a cumulative total at the end: +- List the human-readable size of all `.jpg` files in current directory, and show a cumulative total at the end: -`du -ch {{*/*.jpg}}` +`du -ch {{./*.jpg}}` - List all files and directories (including hidden ones) above a certain [t]hreshold size (useful for investigating what is actually taking up the space):