[英]How to list the files and folders in a directory with its total size in Linux?
I can't get any command to list all the files and folders with its total size in a directory without showing all the sub-directories. 我无法在不显示所有子目录的情况下获得任何命令来列出目录中所有文件和文件夹的总大小。 eg I have a directory as
例如我有一个目录
ls /home/kayan/data/
data-1 data-2 test.txt readme.txt
here data-1 and data-2 are two folder having plenty of sub-folders and files. 这里data-1和data-2是两个文件夹,其中包含许多子文件夹和文件。 Their actual sizes are 123G and 115G.
它们的实际大小是123G和115G。
When I am using "du" command it is listing all the sub-directories and taking too much time. 当我使用“ du”命令时,它列出了所有子目录,并且花费了太多时间。 When I am using "ll" it is not showing the actual size of a folder which has sub-folders.
当我使用“ ll”时,它没有显示具有子文件夹的文件夹的实际大小。 What I want is like something:
我想要的是某种东西:
data-1 123G
data-2 115G
test.txt 12K
readme.txt 14K
You can use "du" command to achieve that. 您可以使用“ du”命令来实现。 Go to the right directory and type
转到正确的目录并键入
du -sh *
It will list all files and directories in the current directory like 它将列出当前目录中的所有文件和目录,例如
123G data-1
115G data-2
12K test.txt
14K readme.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.