Possible Duplicate:
Directory size calculation difference
I don't understand how the du
command under Linux works.
I wanted to count the overall size of a few hundred, small files and du -sh
returned something along the lines of 150MB. I didn't question it until I realized my file manager displayed only around 50MB for the same set of data and I got confused.
Here's what I then tried:
fkochem@WK-6:~/temp$ cat test
a
fkochem@WK-6:~/temp$ du -sh test
4.0K test
So, now this must be a mistake? I looked at du -sh *
of my original data and found the following:
4.0K NCO-0.9.9.9.json
4.0K NCO-0.99.9.json
4.0K NCO-0.9.9.json
8.0K NCO-0.99.json
8.0K NCO-0.9.json
Why does du
seem to count in 4KB steps? What am I missing here?
wc -c
. If you need the sum, you can alwayscat *.json | wc -c
, or for a recursive versionfind . -name "*.json" -print0 | xargs -0 cat | wc -c