`du -s .` and `du -hs .` gives different results (on OS X)
du
without an output format specifier gives disk usage in blocks of 512 bytes, not kilobytes. You can use the option -k
to display in kilobytes instead. On OS X (or macOS, or MacOS, or Macos; whichever you like), you can customize the default unit by setting the environment variable BLOCKSIZE
(this affects other commands as well).
The problem is that du
returns the size in number of blocks of 512 bytes.
In order to have the size in KB, you can use the -k
option that use 1024-byte blocks instead:
$ du -ks .
43351596 .
$ du -khs .
41G .