APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

find large files

© December 2004 (various authors)

What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):

From: Bill Campbell <bill@celestial.com>
Subject: Re: sco-list: Locating large files
Date: Wed, 10 Jan 2001 16:52:42 GMT
References: <t5o3s4sgrqsqb6@corp.supernews.com> 


On Wed, Jan 10, 2001 at 07:30:12AM -0000, Venugopal wrote:
>Frequently I need to create space on my server.I have written the 
>following script to locate the biggest files in a given directory.
># shell script fbf to get given no. of big files
># usage fbf nn where nn is the requd. no. of files
>du -k -a | sort -n -r | head -$1 | awk -e 
>The above script gives me the names of the sub-directories and files.
>Is there a way to eliminate the directory entries?
>Is there a simpler way to do this job?

Here's a crude shell script I wrote at least 15 years ago (it still uses
awk, and everything I've written since 1990 or so is perl :-).  I call this
``lsize'', and it totals the size of all files in a directory.  The -r
option sorts by size in reverse order.

INTERNET:   bill@Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: https://www.celestial.com/

``Never blame a legislative body for not doing something.  When they do
nothing, that don't hurt anybody.  When they do something is when they
become dangerous.''
    Will Rogers


case $# in
        0)      args="*"        ;;
        *)      case $1 in
                -r)     SORT=TRUE;

case $SORT in
        TRUE) ls -li $* | sort +0n -u |
                sort +5rn |awk '{sum+=$6; printf("%8d %8d %s\n",sum, $6, $10)}' 
                ls -l $* | awk '{sum+=$5; printf("%8d %8d %s\n",sum, $5, $9)}'


Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> find large files ––>Re: sco-list: Locating large files

Inexpensive and informative Apple related e-books:

Take Control of High Sierra

Photos for Mac: A Take Control Crash Course

Take Control of Preview

El Capitan: A Take Control Crash Course

Take Control of Upgrading to El Capitan

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

All this modern technology just makes people try to do everything at once. (Bill Watterson)

Linux posts

Troubleshooting posts

This post tagged:


Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode

SCO Unix Sales, Support, & Service

Phone:  707-SCO-UNIX (707-726-8649Toll Free: 833-SCO-UNIX (833-726-8649)