DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: largest files in UNIX file system - script needed

  1. #1
    Join Date
    Dec 2001
    Location
    Keene, NH
    Posts
    510
    Okay, I may take some heat for posting a UNIX question but I'm certain every DBA has had this issue.

    Does anyone have a script that drills down all sub directories starting in a given directory and lists files in the order of size, largest to smallest?

    Thanks!

  2. #2
    Join Date
    Apr 2002
    Location
    Germany.Laudenbach
    Posts
    448
    Code:
    du -sk . # the '.' is the root-dir for this command you also can use '*' but only visible Dirs are listed
    This was for directories only

    use the find -cammand ( deep filesearch )
    Code:
    find . -print # look in manpages for order-option


    Orca

    [Edited by Orca777 on 07-23-2002 at 10:21 AM]

  3. #3
    Hi,

    Try this:

    du -sk * | sort -n

    regards,
    feroz

  4. #4
    Join Date
    Jul 2001
    Location
    Slovenia
    Posts
    422
    Putting it all together:
    find . ! -type d -exec du -sk {} \; | sort -nr

    Tomaz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width