本文介绍了目录中所有文件内容的总大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用ls或du时,我将获得每个文件占用的磁盘空间量.
When I use ls or du, I get the amount of disk space each file is occupying.
我需要打开每个文件并计算字节数后得到的文件和子目录中所有数据的总和.如果我能在不打开每个文件也不计数的情况下获得此奖励积分.
I need the sum total of all the data in files and subdirectories I would get if I opened each file and counted the bytes. Bonus points if I can get this without opening each file and counting.
推荐答案如果要表观大小"(即每个文件中的字节数),而不是磁盘上文件占用的大小,请使用-b或--bytes选项(如果您的Linux系统具有GNU coreutils ):
If you want the 'apparent size' (that is the number of bytes in each file), not size taken up by files on the disk, use the -b or --bytes option (if you got a Linux system with GNU coreutils):
% du -sbh <directory>更多推荐
目录中所有文件内容的总大小
发布评论