I'm trying to use du
to investigate disk usage in a directory like so:
du -hd1 | sort -rh
This gives me a list that starts as follows
61G .
7.9G ./A
5.1G ./B
2.7G ./.C
1.6G ./.D
1.2G ./.E
1.2G ./F
850M ./.G
724M ./H
666M ./I
281M ./J
249M ./.K
150M ./.L
The rest of the list sums up to less than 1GB and there are no large files directly contained in that directory:
ls -Slh
total 1.8M
...
What is the source of the discrepancy between the total 61GB and the sum of less than 25GB of the directory sums?
ls -Slh
doesn't count hidden files in "total" (add-a
) and counts all hard links to a same files so can't be used for disk usage. – Stéphane Chazelas Mar 06 '15 at 11:53