Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was looking through my system with du -sch ./* to find the big useless files I may have stockpiled with no reason, when I found this:

$ du -sch ./*
du: cannot read directory ‘./drbunsen/.gvfs’: Permission denied
du: cannot read directory ‘./drbunsen/.cache/dconf’: Permission denied
18G ./drbunsen
18G total

$ cd drbunsen/
$ du -sch ./*
601M ./Desktop
20K ./Documents
598M ./Downloads
4.0K ./flash
4.0K ./Music
8.0M ./Pictures
4.0K ./Public
4.0K ./Templates
4.0K ./Ubuntu One
8.0K ./Videos
11G ./VirtualBox VMs
6.9M ./workspace
12G total

How do I make hidden files visible? du -sch ./.* gives the same result as du -sch ./*.

Thanks in advance

share|improve this question

2 Answers 2

up vote 36 down vote accepted


du -sch .[!.]* * |sort -h

in your home folder.

share|improve this answer
Thanks, you are a genius. I am not a master in bash, what doe [!.] do? –  Dr_Bunsen Oct 22 '13 at 14:43
@Dr_Bunsen: It's a glob that lists all the files that start with a single .. Here's a neat trick: if you don't know what a glob-looking thing does, try running echo .[!.]* or whatever. The shell will then expand the glob and pass it into echo, printing out the list of files that results. –  Tikhon Jelvis May 21 '14 at 17:46

When you run that same command inside the directory, it is not including the hidden files which start with . in the count. If you have Steam for example installed, it default to installing games under ~/.local/share/Steam/ and it itself is installed there as well.

Under bash you apparently need to run du -sch .[!.]* * as it does not properly expand the .* glob. Under zsh or other shells, du -sch * .* should work, as .* should be expanded to include the list of all hidden files in the current directory.

share|improve this answer
OK. There is apparently a problem with bash then, as it doesn't seem to properly expand .*. But du -sch * .* does do the correct thing under zsh. Under bash, du -sch .* seems to count . but doesn't expand to show files individually. –  dobey Oct 22 '13 at 13:39
For me .* also expands to ../* and therefore du goes out of the directory that I want to see its size! I had to use ./.[^.]* instead. –  Ari Sep 19 '14 at 22:58

protected by Community Sep 5 '14 at 7:08

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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