简体   繁体   English

在子文件夹中的 Unix 中使用 du -hs * 命令出现差异

[英]Discrepancy using du -hs * command in Unix in subfolders

Ciao, I have the following problem.再见,我有以下问题。

When I use the command du -hs foldername I can see that the folder I am analysing has a size of 80Gb.当我使用命令du -hs foldername时,我可以看到我正在分析的文件夹大小为 80Gb。

在此处输入图像描述

But if use cd foldername and rerun the script (or the code ls -lah to see the details of each file) I can not find files that justify that size.但是,如果使用cd foldername并重新运行脚本(或代码ls -lah以查看每个文件的详细信息),我找不到证明该大小的文件。

在此处输入图像描述

Can you explain me why?你能解释一下为什么吗?

How can I find the files/folder that more than anyone contribute to the 80Gb?我怎样才能找到比任何人都贡献 80Gb 的文件/文件夹?

Thank you for your help谢谢您的帮助

Probably because * doesn't include files/directories with names that start with a dot.可能是因为*不包括名称以点开头的文件/目录。

Instead of using du -sh * , use du -ah -d 1 .不要使用du -sh * ,而是使用du -ah -d 1 It will start at the current directory, instead of taking a list of files/directories from the commandline.它将从当前目录开始,而不是从命令行获取文件/目录列表。 -a tells it to include files as well as directories, and -d 1 tells it to list down to a "maximum depth" of 1, ie show files in the current directory, and show the totals for subdirectories of the current directory, but don't show a detailed list of everything in those subdirectories. -a告诉它包括文件和目录, -d 1告诉它列出“最大深度”1,即显示当前目录中的文件,并显示当前目录的子目录的总数,但是不要显示这些子目录中所有内容的详细列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM