Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
Search Forums:



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-11-2010
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 77
Thanks: 3
Thanked 0 Times in 0 Posts
Biggest files on FS /

Hi!

I'm using Unix HP

I'm looking for a command which find the 20 (less or more) biggest files on / but which exclude every other files system

Thanks
Sponsored Links
    #2  
Old 03-11-2010
pludi's Avatar
pludi pludi is offline Forum Staff  
Cat herder
 

Join Date: Dec 2008
Location: Vienna, Austria, Earth
Posts: 5,486
Thanks: 38
Thanked 324 Times in 301 Posts
You'll have to find all files on the root device, telling find to exclude other mounted filesystems, and have it report the size in a common format (eg. in kilobytes). Then you can sort that output in reverse, and have head display the first 20 lines. Or, in code:

Code:
find / -xdev -type f -exec du -ks {} \; | sort -nr | head -20

Sponsored Links
    #3  
Old 03-11-2010
hergp's Avatar
Registered User
 

Join Date: Jan 2010
Location: Vienna, Austria
Posts: 421
Thanks: 2
Thanked 73 Times in 67 Posts
A faster approach, without executing an external program over and over, would be

Code:
find / -xdev -type f -ls | sort +6nr -7 | head -20

    #4  
Old 03-11-2010
pludi's Avatar
pludi pludi is offline Forum Staff  
Cat herder
 

Join Date: Dec 2008
Location: Vienna, Austria, Earth
Posts: 5,486
Thanks: 38
Thanked 324 Times in 301 Posts
Quote:
Originally Posted by hergp View Post
A faster approach, without executing an external program over and over, would be

Code:
find / -xdev -type f -ls | sort +6nr -7 | head -20

On Linux, yes. On HP-UX (as the OP stated) it won't work as that find doesn't understand the -ls switch.
Sponsored Links
    #5  
Old 03-11-2010
Registered User
 

Join Date: Apr 2004
Location: /FRANCE/Nantes
Posts: 77
Thanks: 3
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by pludi View Post
On Linux, yes. On HP-UX (as the OP stated) it won't work as that find doesn't understand the -ls switch.
You're right.
Thanks hergp and pludi for your help
Sponsored Links
    #6  
Old 03-11-2010
hergp's Avatar
Registered User
 

Join Date: Jan 2010
Location: Vienna, Austria
Posts: 421
Thanks: 2
Thanked 73 Times in 67 Posts
The -ls switch is not only available on Linux but also on Solaris. If HP-UX doesn't understand it then you still can reduce the number of executions of du (in my testdrive on Solaris by factor 40) using

Code:
find / -xdev -type f | xargs du -k | sort +0rn -1 | head -20

Sponsored Links
    #7  
Old 03-11-2010
methyl methyl is offline Forum Staff  
Moderator
 

Join Date: Mar 2008
Posts: 5,652
Thanks: 205
Thanked 560 Times in 539 Posts
The hergp looks ok but fails on HP-UX when filenames contains spaces.

This visually inefficient method gives the correct answer very quickly.


Code:
find // -xdev -type f -size +1000000c -exec ls -lad {} \;| \
             awk '{print $5,$9}'|sort -n -r|head -20

If you have less than 20 files larger than 1,000,000 bytes then reduce the constant!

Last edited by methyl; 03-11-2010 at 05:22 PM.. Reason: typos
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Top 5 biggest file yoavbe Shell Programming and Scripting 5 12-18-2009 08:06 AM
sort biggest most recent files tjmannonline UNIX for Dummies Questions & Answers 3 12-16-2008 12:23 AM
finding biggest number hankooknara Shell Programming and Scripting 3 06-19-2007 10:02 PM
top biggest files 3rr0r_3rr0r Solaris 3 01-25-2007 08:32 AM
The biggest newb ever... BoneMalone UNIX for Dummies Questions & Answers 3 07-22-2003 01:29 AM



All times are GMT -4. The time now is 03:00 AM.