Find top 10 largest files in /var directory (subdirectories and hidden files included )

tree -ihafF /var | tr '[]' ' '| sort -k1hr|head -10
Same as above, but modified to show human readable output
Sample Output
 174M   /var/lib/snapd/snaps/spotify_34.snap
 169M   /var/cache/pkgfile/community.files
 151M   /var/lib/snapd/snaps/gnome-3-28-1804_31.snap
 151M   /var/lib/snapd/snaps/gnome-3-28-1804_36.snap
 144M   /var/lib/snapd/snaps/gnome-3-28-1804_23.snap
 132M   /var/lib/snapd/snap/spotify/34/usr/share/spotify/libcef.so
 116M   /var/cache/pacman/pkg/libreoffice-fresh-6.2.2-4-x86_64.pkg.tar.xz
 112M   /var/log/journal/f0be989aba024547ad095245b1c9e100/system@4ba3e3da5ee94965bb22f9942a24670d-0000000000000001-000

2
By: nv21
2019-04-23 22:52:45

2 Alternatives + Submit Alt

What Others Think

The only safe way to avoid odd chars in filenames find /var -type f -printf '%s %p\0' | sort -z -k1,1gr | head -z -n10 | tr '\000' '\n'
daPeach · 16 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: