On Wed, 11 Dec 2002, Randy Franklin wrote:
> On Thursday, December 12, 2002, at 04:10  AM, IS Department wrote:
>> I would like to get a listing of the 100 or 500 or 1000 largest files
>> on my system. Does anyone know of a command or script to do this? I
>> would want file name/location and size in bytes.
>
> If you have enough RAM and patience, this will work:
>
> bash# find / -type f -size +1024k -print
>
> That will list all files larger than 1MB.  To get a listing of all,
> sorted by size, do this (again, with lots of RAM and patience):
>
> bash# find / -type f -print | xargs -i ls -l {} | awk '{print $5, $9}'
>  > file.list

What if your file names have spaces in them?

> Open file.list and replace every space (i.e. " ") with a tab.  In vi,
> this would be s/ /\t/.
>
> Then, do this
>
> bash # sort -n -k 1,8 file.list > sorted.list

I'd just do

 find / -type f -size +1024 -exec ls -ld {} \; | sort -n +4

and get it over with. Sorted ls output is very easy to understand.


-- 
\ \/ / _       |~\  _ In God We Trust. All Others Pay Cash.
 >  < / \|\  /|+-< | |    "The world is a comedy to those that think,
/ /\ \\_/| \/ ||__)|_|     a tragedy to those who feel." - Horace Walpole



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to