- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ls -laR; du; | sort per directory to show decendin...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 12:34 AM
тАО10-19-2001 12:34 AM
Rewards for all suggestions!
Later,
Bill
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 12:42 AM
тАО10-19-2001 12:42 AM
Re: ls -laR; du; | sort per directory to show decending order of file sizes from current directory
for du try:
du -a | sort -n
for ls try:
ls -laR | sort -k5n
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 12:43 AM
тАО10-19-2001 12:43 AM
Re: ls -laR; du; | sort per directory to show decending order of file sizes from current directory
find . -type -d -exec du -sk {} \; |sort -n
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 01:00 AM
тАО10-19-2001 01:00 AM
Re: ls -laR; du; | sort per directory to show decending order of file sizes from current directory
Hows this;
cd
du -k . | sort -nr | more
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 01:17 AM
тАО10-19-2001 01:17 AM
SolutionThis will format it on a per directory basis:
=============================================
find . -type f | xargs ll | awk '{print $5,$NF}' | while read line ; do
echo $(dirname "$line") $(basename "$line")
done | sort -k 2,2 -k 1n,1 |
awk '{if ($2 != dir) {print"====================";print "Directory - "$2;dir=$2}}{$2="";print}'
=============================================
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 01:29 AM
тАО10-19-2001 01:29 AM
Re: ls -laR; du; | sort per directory to show decending order of file sizes from current directory
Nice output...
seems to take a bit of time though, I'd really have prefered an identical or equivalent output a little easier..
Thanks,
Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 01:38 AM
тАО10-19-2001 01:38 AM
Re: ls -laR; du; | sort per directory to show decending order of file sizes from current directory
find . -type f -exec du -sk {} \; |sort -n
Its not sorted in directory order, but it does list all the files and their sizes.
Robin's scripting abilities are amazing...I'm suprised he's not royalty yet.
-Santosh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 01:39 AM
тАО10-19-2001 01:39 AM
Re: ls -laR; du; | sort per directory to show decending order of file sizes from current directory
hope i understood you right. You want a per directory list of files sorted by size, correct?
I would do something like:
for dir in `ls -d *` do
du -sk $dir/* | sort -rn
done
This will sort the files in each directory descending on filesize.
Hope this helps
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-19-2001 02:09 AM
тАО10-19-2001 02:09 AM
Re: ls -laR; du; | sort per directory to show decending order of file sizes from current directory
Actually, looking at Stefan's solution, mine's a bit OTT, but I've been waiting so long for these pages today, I got a bit carried away.
Rgds, Robin.