![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
LinkBacks (?)
LinkBack to this Thread: http://www.unix.com/unix-dummies-questions-answers/53240-unix-shell-script-finding-top-ten-files-maximum-size.html
|
||||
| Posted By | For | Type | Date | |
| terjeo's Bookmarks on Delicious | This thread | Refback | 12-26-2008 11:06 AM | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding cumulative size of files older than certain days | rohan076 | Shell Programming and Scripting | 1 | 04-28-2008 01:07 PM |
| shell script to find files by date and size | dadadc | UNIX for Dummies Questions & Answers | 1 | 10-20-2007 05:18 AM |
| Maximum size of a file in unix | nagalenoj | UNIX for Dummies Questions & Answers | 3 | 08-16-2007 09:56 AM |
| finding duplicate files by size and finding pattern matching and its count | jerome Sukumar | Shell Programming and Scripting | 2 | 12-01-2006 04:20 AM |
| bash script working for small size files but not for big size files. | davidpreml | Shell Programming and Scripting | 1 | 11-01-2006 11:06 AM |
![]() |
|
|
LinkBack (1) | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Unix shell script for finding top ten files of maximum size
I need to write a Unix shell script which will list top 10 files in a directory tree on basis of size. i.e. first file should be the biggest in the whole directory and all its sub directories.
Please suggest any ideas |
|
||||
|
You don't need a "script", it fits into a single line:
find /start/dir -type f -exec du {} \; | sort -rn | head -10 bakunin |
|
||||
|
Thanks it is listing , But the size that shows when i run ls -l command and the size that is showing for this command is different can you please let me know the reason
example : $ ll /pfta02/10.001 -rw-rw-rw- 1 pnt pf 87843360 Feb 6 02:21 /pfta02/10.001 $ find /pfta03 -type f -exec du {} \; |sort -rn | head -1 171572 /pfta02/10.001 why the size listing is as 171572 instead of 87843360 ... IS any convertion happening ?.. |
|
||||
|
Quote:
Use "du -h", it will report the size in a human readable form. However, this will make the sort a bit more complex. To maintain the sort as it is, use "du -k" which reports in kbytes instead of blocks, meaning the output numbers will be half as big. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|