The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to list a file size, but not its name? ordano UNIX for Dummies Questions & Answers 2 02-12-2009 02:00 AM
command to list file size rgordon HP-UX 3 12-05-2007 05:43 AM
List File size komputersman UNIX for Dummies Questions & Answers 10 06-13-2007 05:39 PM
File size limitation of unix sort command. cskumar Shell Programming and Scripting 7 10-07-2005 11:37 AM
list file's by size order in sepecfied directory and sub directories ferretman UNIX for Dummies Questions & Answers 2 01-03-2002 07:55 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 07-01-2009
ChatPerdu ChatPerdu is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 2
Sort by size, then list file in each directory

Hi,

I have directories with name like:
aaa
bbb
ccc
...

I would like to to see which directories are the largest and then list the files within each. I have success using:

Code:
du -ks * | sort -rin | head -n 20
which gives me an output like:
120 bbb
27 ccc
3 aaa
...

I would like to be able to do a simple "ls" so I have a clearer view of what's in each of the big directory. Without knowing anything about xargs, I am trying:

Code:
du -ks * | sort -rin | head -n 20 | xargs ls
which gives me (on top of the errors) an alphabetical order list of "ls", instead of what I would like which is more like a "-exec ls {}" in "find"...

ls: 3: No such file or directory
ls: 120: No such file or directory
ls: 27: No such file or directory
aaa:
will_cover_page.gif

bbb:
will_dependents_page_2.gif will_dependents_page_4.gif
will_dependents_page_3.gif

ccc:
will_dependents_page_1.gif will_signatures.gif

Is there a more efficient way of doing this? Thanks in advance...
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB 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 -4. The time now is 11:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0