I ran both du -sh . and du -sh * inside a directory, but the values returned by the second one don't add up to nearly the same value reported by the first. 5.7GB vs 1.5 GB. Why is this? Are there some files that the * misses?

$ du -s .
5926440 .
$ du -s *
4   Desktop
4   Documents
8544    video.avi
4   Music
2516    output.mkv
4   packages-microsoft-prod.deb
4   Pictures
4   Public
1513440 repos
52  snap
20  Templates
4   Videos

(reposted from StackOverflow since it's more appropriate here)


The * glob excludes hidden files by default. du -hd1 . shows the expected results - the size adds up to the total shown by du -sh .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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