du command does not parse hidden directories
Actually it does, here is the proof:
mkdir .test
echo "hi" > .test/appo
du -a
4 ./.test/appo
8 ./.test
12 .
The -a
option is used to explicitly show which files were counted.
Are you using du *
?
This command shows you the summarized size of hidden directories using a regular expression:
du -hs .[^.]*
The correct command is : du -hs $(ls -A)
$ du -hs $(ls -A)
0 test
0 .test
du -hs .* *
, as mentioned in another answer, is not correct if you want to list all files and subdirectories (including hidden ones).
Example :
$ touch test
$ touch .test
$ echo *
test
$ echo .* *
. .. .test test
$ du -hs .* *
4,0K .
1,8G ..
Why does du
behave like this? Because you use -s
that summarize the result and that all files and subdirectories are children of .
so du -hs
does not list them!