11

How do I get Ubuntu's "Disk Usage Analyzer" to show me the hidden files?

It tells me my home dir uses 3GB, but only accounts for 525MB (the results of du -shc *). Can I get it to show me the other files that are using the space?

3
  • du already shows all files, it doesn't hide anything. What exactly are the 3GB and 525MB figures reported for? Aug 19, 2010 at 0:00
  • 1
    You should try 'ncdu' which is generally available in your distro's repositories, its text interface is great.
    – Shadok
    Apr 4, 2012 at 16:02
  • You may also need to run as root, and not with sudo but with actual root, via su root.
    – Mikhail
    Nov 7, 2012 at 14:44

7 Answers 7

19

You can use this (it does not match files with a single letter after the '.')

du -shc .??* *

wikipedia also mentions a regex style usage which should work for every file/folder name

du -shc .[!.]* *
1

Call du with the whole home directory rather than every single file:

du -sh ~

That's because the * doesn't match the hidden ones.

3
  • This does not list all the files in ~.
    – lindhe
    Jun 2, 2017 at 8:38
  • @lindhe care to elaborate?
    – cYrus
    Jun 3, 2017 at 12:39
  • Sorry for the ambiguity. It displays the aggregate size of all files (both plain and hidden) in ~. It does not however list the size of each file and subdirectory in ~. I assumed that was what OP wanted, since du -sch * would do that (but only for plain files).
    – lindhe
    Jun 3, 2017 at 13:09
1

I got a similar problem today. My solution:

du -h | awk -F/ '{if (NF<3) {print $1"/"$2}}'

du -h gives us the complete usage of current directory including all subdirectories recursively.

| awk -F/ '{if (NF<3) {print $1"/"$2}}' filters the output and prints no subdirectories.

If you want to see the files in addition to the directories you can use this:

du -ah | awk -F/ '{if (NF<3) {print $1"/"$2}}'

If you want to see exactly which files use the most disk space you can add | sort -h at the end.

1

You can use "find" + "du" to see the hidden files and folders:

find ~ -maxdepth 1 -exec du -hs {} \;
0

When you do

du -shc *

it excludes everything that starts with a dot.

Try:

du -shc ~

instead

3
  • One of the common culprits for chewing space under your home dir is .TRASH, the default trash directory used by distributions like Ubuntu.
    – John T
    Aug 19, 2010 at 1:25
  • 1
    Strangely, this shows 150GB (which I think is the total of all my filesystem usage) - and none of the sub-directories or files. Pretty useless really
    – Stephen
    Aug 19, 2010 at 1:49
  • @Stephen: you may have symlinks that are throwing things off. Try adding the -D option. Aug 19, 2010 at 6:46
0

Other possibilities for unaccounted for space (other than the very valid point about . files and * expansion others suggested) include the 5% of the disk that is occasionally reserved for root (relatively common) and files hidden underneath a mount point.

For that last, imagine you have a folder /tmp/somerandom/raccoon/. In this folder you put 2.5G of video. You then mount your USB disk on /tmp/somerandom/. You can no longer access the file/files that you put in /tmp/somerandom/raccoon, but they still take up disk space. du doesn't see them, but df does.

0

Disk Usage Analyzer does not show files (as I would expect) - if the % below a certain directory don't show up, then open the folder and look at the files individually.

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.