Hidden files in Disk Usage Analyzer

9

4

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?

Stephen

Posted 2010-08-18T22:54:36.873

Reputation: 283

du already shows all files, it doesn't hide anything. What exactly are the 3GB and 525MB figures reported for? – Gilles 'SO- stop being evil' – 2010-08-19T00:00:28.160

1You should try 'ncdu' which is generally available in your distro's repositories, its text interface is great. – Shadok – 2012-04-04T16:02:43.703

You may also need to run as root, and not with sudo but with actual root, via su root. – Mikhail – 2012-11-07T14:44:54.473

Answers

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 .[!.]* *

zakkak

Posted 2010-08-18T22:54:36.873

Reputation: 293

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.

cYrus

Posted 2010-08-18T22:54:36.873

Reputation: 18 102

This does not list all the files in ~. – lindhe – 2017-06-02T08:38:00.173

@lindhe care to elaborate? – cYrus – 2017-06-03T12:39:04.393

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 – 2017-06-03T13:09:31.987

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.

birru

Posted 2010-08-18T22:54:36.873

Reputation: 11

0

When you do

du -shc *

it excludes everything that starts with a dot.

Try:

du -shc ~

instead

Paused until further notice.

Posted 2010-08-18T22:54:36.873

Reputation: 86 075

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 – 2010-08-19T01:25:18.113

1Strangely, 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 – 2010-08-19T01:49:23.483

@Stephen: you may have symlinks that are throwing things off. Try adding the -D option. – Paused until further notice. – 2010-08-19T06:46:36.793

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.

Slartibartfast

Posted 2010-08-18T22:54:36.873

Reputation: 6 899

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.

Stephen

Posted 2010-08-18T22:54:36.873

Reputation: 283

0

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

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

DiFS

Posted 2010-08-18T22:54:36.873

Reputation: 1