LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-07-2006, 12:13 AM   #1
tyreth
LQ Newbie
 
Registered: Mar 2005
Posts: 4

Rep: Reputation: 0
Find 100 largest files in folder tree


Hi,

I have a folder with many subfolders and files that I'd like to list the largest 100 files in.

I'm pretty sure I need to use a combination of find and ls, but I'm not sure exactly what will let me do this.

Thanks
 
Old 02-07-2006, 12:21 AM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Check out this link for some ideas http://www.debian-administration.org/articles/143

Or try something like find / -size 10000k to find the files over XXXX bytes...
 
Old 02-07-2006, 08:18 AM   #3
WilliamsJD
LQ Newbie
 
Registered: Nov 2003
Distribution: Fedora Core 4
Posts: 11

Rep: Reputation: 0
Empirically, the way to find the 100 largest files would be like this:

find . -ls | sort -rn +6 -7 | head -100

This does a long listing on all the files under "." (you could use any directory), sorts them by size (reverse order) and gives the first 100.

The main problem with this approach is that if the number of files is very large (I'd say over 100,000) it could take a while. These are pretty fast commands, though, and would run fairly quickly on most systems.

Also, the output is in a long listing-like format, so you probably would need to crunch it through AWK to get just the info you're looking for.

Hope that helps.
WilliamsJD
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder List With Numbers Over 100 In Filenames hazmatt20 Linux - General 14 01-09-2006 02:17 AM
Makefile to resursively compile a folder tree yapp Programming 5 06-14-2005 07:51 PM
How to find a work within a folder full of text files? juanb Linux - General 4 05-03-2005 04:09 PM
Where to find Kernel Source Tree cacososa Linux - Software 4 12-06-2003 03:50 AM
Where can I find Kernel Source Tree? cacososa Linux - Software 1 12-05-2003 05:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration