`ls -l` 中的总数

rya*_*ogo 4 osx ls

当我运行时ls -l,显示以下内容:

>: ls -l
total 320
-rw-r--r--   1 foo  staff    633  5 Apr 13:23 A.class
-rw-r--r--   1 foo  staff    296  5 Apr 13:24 A.java
...
Run Code Online (Sandbox Code Playgroud)

是什么意思total?尺寸?如果有,尺寸是多少?

gee*_*aur 6

它是从每个文件结构的和元素获得的块总数(通常每个 POSIX 为 512 字节;有关环境变量man ls的详细信息,请参阅 参考资料)。因此,它不是递归的,也不会因“稀疏”文件而变得臃肿。$BLOCKSIZEst_blocksst_blocksizestat()


pdo*_*pdo 5

man 1 lsMac OS X 10.6.7 开始,特别是标题为“长格式”的部分

In addition, for each directory whose contents are
displayed, the total number of 512-byte blocks used by the files in the directory is
displayed on a line by itself, immediately before the information for the files in
the directory.
Run Code Online (Sandbox Code Playgroud)