Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 26th January 2006, 11:15 PM
techmum Offline
Registered User
 
Join Date: Dec 2005
Location: Western Australia
Posts: 267
Howto sort & list files from multiple directories by size?

Hi

I have learnt that I can use>

ls -s -S -R

to recursively list files by size from within multiple directories. However this shows a sorted list for each directory.

Looking for help so that I can generate a sorted list that puts all the files from a directory structure in descending order by file size + displays full path of the file name.

Thus the result I am after is track down large files in /home/techmum that I can delete as I need to gain some disk space without having to examine the output of every single directory, of which I've got lots!

Last edited by techmum; 26th January 2006 at 11:26 PM.
Reply With Quote
  #2  
Old 27th January 2006, 12:07 AM
buddha Offline
Registered User
 
Join Date: Apr 2005
Location: Texas
Posts: 372
Hey techmum,

a bit of thinking required for this one....hmmm....very specific reqmts....

Code:
find /home/techmum -type f -printf "%12k %h/%f\n" | sort -nr
ugly, isn't it?

the -type f selects only files, without this option you'll get directories also
the size is output in KB

a different way:
Code:
du -a /home/techmum | sort -nr
but you get directory totals with this

finally, just to find large files, you can use find like this:
Code:
find /home/techmum -size +20M
which will show you all files greater than 20 MB (add the printf stuff from above if you want the size printed also)

there's probably (hopefully) an easier way, but I can't think of one right this moment..............
Reply With Quote
  #3  
Old 27th January 2006, 12:11 AM
Firewing1 Offline
Registered User
 
Join Date: Dec 2004
Location: Canada
Age: 23
Posts: 9,224
You know there is a how-to forum for this purpose, eh?
But nice tip... I prefer the find command -- It does recursive searches. I use it for varying things too, when I quickly need to find files in a directory and it's sub-directories.
Can i also suggest the '-maxdepth' option?
-maxdepth 1
searches only the current dir,
-maxdepth 2
the current + 1 directory deep, etc...
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #4  
Old 27th January 2006, 12:46 AM
gnjunior Offline
Registered User
 
Join Date: Jan 2006
Posts: 14
Hi,

You can use the dir command:

dir -lSR ~

Hope this can help
Reply With Quote
  #5  
Old 27th January 2006, 02:45 AM
techmum Offline
Registered User
 
Join Date: Dec 2005
Location: Western Australia
Posts: 267
wow buddha >
find /home/techmum -size +20M
provides a really simple way to track down the larger files hanging around my system. Just perfect. I've also noted the other points as they may come in handy in the future.

Firewing1, I should have titled the thread with a different name as if I understand the Howto section, it is for posts with solutions rather than questions. Is that correct?

I've also noted the -maxdepth info that will be useful. Thanks.
Reply With Quote
  #6  
Old 27th January 2006, 02:50 AM
Firewing1 Offline
Registered User
 
Join Date: Dec 2004
Location: Canada
Age: 23
Posts: 9,224
Quote:
Originally Posted by techmum
wow buddha >
find /home/techmum -size +20M
provides a really simple way to track down the larger files hanging around my system. Just perfect. I've also noted the other points as they may come in handy in the future.
Firewing1, I should have titled the thread with a different name as if I understand the Howto section, it is for posts with solutions rather than questions. Is that correct?
I've also noted the -maxdepth info that will be useful. Thanks.
yeah... I don't really wanna take up the job of community moderators, but generally, it's better to post in the correct forum...
Firewing1
__________________
[+] My open source software and blog
[+] Some of my howtos: (for full list, click here)
Reply With Quote
  #7  
Old 27th January 2006, 02:54 AM
jim Offline
Retired Community Manager & Avid Drinker Of Suds
 
Join Date: Feb 2005
Location: Rochester NY
Age: 39
Posts: 4,175
moved thread
__________________
Registered Linux User: #376813
Western NY
My linux site
Smolt Profile

please remember to say if you problem was solved

Did you get your id10t award today?
Reply With Quote
Reply

Tags
directories, files, howto, list, multiple, size, sort

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ls option to list directories followed by files php1ic Using Fedora 3 24th March 2009 04:58 PM
copying one file to multiple directories. Utterlynoobish Using Fedora 0 27th November 2008 10:01 PM
how can I see directories ordered by content file size? DennyCrane Using Fedora 2 23rd September 2008 04:17 AM
What tool can I use to backup specific files/directories to multiple DVDs? HawkBoy Using Fedora 1 31st October 2007 05:02 AM
Howto increase subtitle size in gmplayer (avi-files)? tsorvoja Using Fedora 1 20th June 2006 12:59 PM


Current GMT-time: 04:15 (Tuesday, 02-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat