Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think my du command is confused.

% du -shc DIR ...
6123941496      total

% du -shc DIR ...
6.1G    total

% du -sc --si DIR ...
6.6G    total

I've tried giving LANG=C and double-checking the result in a spreadsheet. It looks like -h already outputs using powers of 1000 (--si), and --si gives wrong answer. I think the correct answer should be 5.7G for -h and 6.1G for --si. So what happens here?

% du --version
du (GNU coreutils) 8.20

% uname -a
Linux XXX 3.9-1-amd64 #1 SMP Debian 3.9.8-1 x86_64 GNU/Linux
share|improve this question
Please include the actual commands. What do the ... represent? You seem to have run the exact same command twice and have gotten different output, is that so? Have you read the explanation of the size modifiers in man du? – terdon Oct 10 '13 at 4:06
up vote 6 down vote accepted

Repeat your tests using the --apparent-size switch.

$ du -shc --apparent-size DIR ...

excerpt from du man page

       print  apparent sizes, rather than disk usage; although the apparent size is
       usually smaller, it may be larger due to holes in (`sparse') files, internal 
       fragmentation, indirect blocks, and the like
share|improve this answer
Ah, so apparently -b is equivalent to '--apparent-size --block-size=1'. I missed that. Using 'du -shc --apparent-size' now correctly gives 5.7G now. Thanks! – Gerry Lufwansa Oct 10 '13 at 5:31
@GerryLufwansa - yeah when you start mixing in different filesystems or mounted CIFS ones it becomes really noticeable. I always use either -b or --apparent-size. – slm Oct 10 '13 at 11:34
... and the difference can get really huge with HSM systems, where migrated files report 0 (or something like a few kB) without --apparent-size. – Ansgar Esztermann Oct 10 '13 at 11:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.