20

I have a folder with 40 GB of dozens of directories and stuff, and I want to see the exact size of the root folder in bytes ..

I have tried using this, but it shows the size in kilobytes:

du -s foldername

Ahmad
  • 1,261

3 Answers3

29

Use the -B1 parameter to du:

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

You could also try the --apparent-size flag

knittl
  • 1,162
8

du - estimate file space usage

-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'

For Example,

user$ du -B1 filename
4
du -sb foldername

seems to do the trick