Finding all large files in the root filesystem
Try:
find / -xdev -type f -size +100M
It lists all files that has size bigger than 100M.
If you want to know about directory, you can try ncdu
.
If you aren't running Linux, you may need to use -size +204800
or -size +104857600c
, as the M
suffix to mean megabytes isn't in POSIX.
find / -xdev -type f -size +102400000c
In addition to @Gnouc answer , you can also add ls -la
to get more details. You should have sudo privileges
to do that .
$ find / -xdev -type f -size +100M -exec ls -la {} \; | sort -nk 5
To only see files that are in the gigbyte, do:
root# du -ahx / | grep -E '\d+G\s+'
1.8G /.Spotlight-V100/Store-V2/A960D58E-A644-4497-B3C1-866A529BF919
1.8G /.Spotlight-V100/Store-V2
The following command not only find you the top 50 largest files (>100M) on your filesystem, but also sort (GNU sort
) by the biggest:
find / -xdev -type f -size +100M -exec du -sh {} ';' | sort -rh | head -n50
-xdev
Don't descend directories on other filesystems.On BSD
find
use-x
which is equivalent to the deprecated-xdev
primary.
For all files and directories, it's even easier:
du -ahx / | sort -rh | head -20
(the -x
flag is what's required to constrain du
to a single filesystem)
If you're not using GNU sort
(from coreutils
), use it without -h
:
du -ax / | sort -rn | head -20
For current directory only (for quicker results), replace /
with .
.