Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-17-2008, 06:40 PM   #1
LQ Newbie
Registered: Oct 2005
Location: Queensland, Australia
Distribution: Solaris
Posts: 14

Rep: Reputation: 0
Question Howto? List all files in all directories ordered by size?

How can you list ALL files on a machine, ordered by file size?
Old 06-17-2008, 07:31 PM   #2
LQ Newbie
Registered: Mar 2006
Posts: 2

Rep: Reputation: 0
There are a couple of ways.

If you can read as fast as the symbols going by your eyes when you use the matrix like screen saver then just use this:

ls -SR /

That breaks down to ls (list) -S (put in order by the file size) R (recursive, it follows the subdirectories)

All you have to do is add an "lh" in between the SR and you will get the file size in human readable format.

This will scream by, at a mind numbing pace, so I would pipe it to a file. The entire way that I would recommend is as follows:
ls -SlhR / > biglistoffiles.txt

Good luck, and may the penguin be with you.
Old 06-17-2008, 07:55 PM   #3
LQ Newbie
Registered: Oct 2005
Location: Queensland, Australia
Distribution: Solaris
Posts: 14

Original Poster
Rep: Reputation: 0

Thanks for your reply. I should have been a bit more specific - i.e. list only files and not directories, and order by file size...

I did end up figuring something out after looking at related posts and using awk and sort (haven't really used them before).

find / -type f -ls | awk '{print $2, $11}' | sort -rn


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation of ordered list rblampain Programming 0 07-28-2007 04:51 AM
List all files in multiple directories haiders Linux - Newbie 6 05-10-2007 12:05 PM
Getting a list of directories with certain files inside... Banacek Linux - Newbie 7 11-27-2006 05:43 PM
Insert an ordered list into your message SidA Red Hat 0 06-19-2004 07:49 PM
list size of directory and all directories it contains? ubien Linux - General 2 01-11-2003 10:59 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:47 AM.

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