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?
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 .[!.]* *
.??* *
and not just .??*
. They seem to do the same thing. And what syntax accounts for * *
anyway?
du -shc .??* *
includes both hidden (.??*
) and visible (*
) files/folders, while du -shc .??*
shows only the hidden ones. We are essentially passing two patterns.
Call du
with the whole home directory rather than every single file:
du -sh ~
That's because the *
doesn't match the hidden ones.
~
. 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).
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.
You can use "find" + "du" to see the hidden files and folders:
find ~ -maxdepth 1 -exec du -hs {} \;
When you do
du -shc *
it excludes everything that starts with a dot.
Try:
du -shc ~
instead
.TRASH
, the default trash directory used by distributions like Ubuntu.
-D
option.
Aug 19, 2010 at 6:46
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.
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.
du
already shows all files, it doesn't hide anything. What exactly are the 3GB and 525MB figures reported for?