I need to show space utilisation on the system, and find the largest 3 files on /home (or any other folder)

I've been using 2 different command lines

df -m -a -h
df -m -h /home

I still can't manage to get it to show me only the 3 largest files on that folder

4 Answers 4


For top 3 files, with GNU find, and assuming no filename contain newline characters:

find /path/to/dir -type f -printf "%s %p\n" |sort -nr |head -3

That gives the 3 largest files in term of file size. For disk usage instead, replace %s with %b.


For top 3 files and folders in the current directory. It will show you the largest files and folders.

du -sm ./* 2>/dev/null | sort -n -r | head -n 3

If you really insist on files only, then X Tian's solution is better.


If you're using modern GNU versions of du and sort, this will show you the sizes:

$ du -hs * | sort -hr
53G         projects
21G         Desktop
7.2G        VirtualBox VMs
3.7G        db
3.3G        SparkleShare
2.2G        Dropbox
272M        apps
47M         incoming
14M         bin
8.6M        parking_lot
5.7M        rpmbuild
76K         task.ref.pdf
68K         vimdir.tgz

With zsh, you can see the 3 largest files (in terms of size, not disk usage) with:

ls -ldh -- *(DOL[1,3])

To check for disk usage, you'd need to define a sort order like:

zmodload zsh/stat
sdu() stat -A REPLY +block -- $REPLY

And use as:

ls -ldh -- *(DnO+sdu[1,3])

If you want to search for the largest file anywhere including subdirectories, change the * above to **/*.

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.