|
Search Forums:
|
|||||||
| Forums | Register | Forum Rules | Linux and Unix Links | Man Pages | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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
|
||||
|
||||
|
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
|
||||
|
||||
|
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
|
|||
|
|||
|
Quote:
Thanks hergp and pludi for your help ![]() |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
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
|
|||
|
|||
|
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 -20If 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 | ||
|
|
![]() |
| Thread Tools | Search this Thread |
| 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 |
|
|