The UNIX Forums  

Go Back   The UNIX Forums > Special Forums > Filesystems, Disks and Memory
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


Filesystems, Disks and Memory Questions involving NAS, SAN, RAID, Robotic Libraries, backups, etc go here.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find largest file mohan705 Shell Programming and Scripting 15 07-03-2007 11:34 PM
list largest files in a directory & its subdirectories igidttam UNIX for Dummies Questions & Answers 6 09-25-2006 08:31 AM
largest size directory in unix arunkumar_mca UNIX for Advanced & Expert Users 5 09-29-2005 10:04 PM
Finding largest file in current directory? AusTex High Level Programming 1 03-13-2005 09:03 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-16-2007
Registered User
 

Join Date: Sep 2005
Posts: 22
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
find the 5o largest files in a directory

I'm trying to find the 50 largest file in a directory named /sasdb and its' subdirectories. I'm using the find command and a pipe to awk
Not sure if I'm actually getting the largest files from this directory and its subdirectories. Here is the code I used...

find /sasdb -ls | awk '{print $0}' | sort -n >> my.lst
tail -50 my.lst >> largest_files.lst


Any suggestions would be greatly appreciated.
Thank You
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-16-2007
Registered User
 

Join Date: Sep 2006
Posts: 1,379
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Code:
find /home/test -printf "%s:%p\n"|sort -k1n|tail -50
Reply With Quote
  #3 (permalink)  
Old 05-16-2007
Registered User
 

Join Date: Sep 2005
Posts: 22
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
I tried this and receiveed an error messge that stated bad option -printf

find /sasdb -printf "%s:%p\n"| sort -kin| tail -50
Reply With Quote
  #4 (permalink)  
Old 05-16-2007
Shell_Life's Avatar
Unix/Informix/4GL/SQL
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 694
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
igidttam,
See if this works for you:
Code:
du -a | sort -nr | head -50
Reply With Quote
  #5 (permalink)  
Old 05-16-2007
Registered User
 

Join Date: Sep 2006
Posts: 1,379
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by igidttam
I tried this and receiveed an error messge that stated bad option -printf

find /sasdb -printf "%s:%p\n"| sort -kin| tail -50
you do not have GNU find.
you first approach should be fine, just that you should check $0 , i don't think its the size. but pls do check.

Code:
find /home/test -type f -ls | awk '{print $7}' | sort -n | tail -50
Reply With Quote
Google UNIX.COM
Reply



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 11:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
UNIX Forum Content Copyright ©1993-2008 SilkRoad Asia All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102