如何查看文件夹的确切大小(以字节为单位)?


13

我有一个包含40 GB的文件夹,其中包含数十个目录和其他内容,我想查看根文件夹的确切大小(以字节为单位)。

我试过使用此方法,但它显示的大小以千字节为单位:

du -s foldername

Answers:


19

使用-B1参数可以du

du -s -B1 foldername
$ man 1 du
 -B, --block-size=SIZE
          use SIZE-byte blocks

您也可以尝试--apparent-size标记


4

du-估计文件空间使用量

-B, --block-size=SIZE
          scale sizes by SIZE before printing them.  E.g., '-BM' prints sizes in units of 1,048,576 bytes.  See SIZE format below.

-b, --bytes
          equivalent to '--apparent-size --block-size=1'

例如,

user$ du -B1 filename

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.