How to locate the largest files in the filesystem

I'm trying to tidy up various disks, most of which have FreeBSD installed, and wondered how to locate which files occupy most space.

Any suggestions?
 
find . -ls | sort -n -k 2

[edit: That sorts in 512-byte blocks, with very wide lines.
I find usually more appropriate
find $where -type f -exec ls -l {} + | sort -n -k5
/edit]

One might want to add
| tail -n $lines
or perhaps
| less +G
where there may be many files?
 
There is a difference between file length and the space a file allocates on disk, for example when there are sparse files.

Field 2 of `find . -ls` counts the latter, field 5 of `ls -l` the former.
 
There is a difference between file length and the space a file allocates on disk, for example when there are sparse files.

True. I don't recall ever having - or at least noticing - a sparse file on my systems in 25 years.

Field 2 of `find . -ls` counts the latter, field 5 of `ls -l` the former.

Quite so. Looking at diskspace I most often use

# du -md1 $where | sort -n [| tail ...]

with du(1) options like -A for sparse files, -a for each file and -s; it's also faster than find, esp. from /
 
Back
Top