Biggest files on FS /


 
Thread Tools Search this Thread
Operating Systems HP-UX Biggest files on FS /
# 1  
Old 03-11-2010
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

ThanksSmilie
# 2  
Old 03-11-2010
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

# 3  
Old 03-11-2010
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
Quote:
Originally Posted by hergp
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.
# 5  
Old 03-11-2010
Quote:
Originally Posted by pludi
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 Smilie
# 6  
Old 03-11-2010
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

# 7  
Old 03-11-2010
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 06:22 PM.. Reason: typos
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find biggest word in a file....?

With any cmd like sed grep ask etc... (1 Reply)
Discussion started by: sidpatil
1 Replies

2. Shell Programming and Scripting

Grep 5 biggest column

please help, file1.txt id,week,ict,outgoing_call,blackberry_problem,gprs_problem,sms_problem,flash_problem,sinyal_lemah,blankspot,incoming_call,mms_problem,kualitas_suara,drop_call,data_probl em,cross_connect,connect_no_voice,vas_problem ,1,sumbagsel,96,127,52,70,28,29,21,18,18,8,5,3,0,0,3... (1 Reply)
Discussion started by: radius
1 Replies

3. Shell Programming and Scripting

help to get the biggest partition with awk

# fdisk -l /dev/sda Disk /dev/sda: 1000.2 GB, 1000204886016 bytes 255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk... (9 Replies)
Discussion started by: yanglei_fage
9 Replies

4. UNIX for Dummies Questions & Answers

List biggest files (Not Directories)

Hello, can you please help me writing a command that would output the biggest files on my system from biggest to smallest? I want this to print only the files, not the directories. I have tried du -a ~ | sort -nr | head -10 However, this also prints out all the directories - which I do... (8 Replies)
Discussion started by: tonydaniels1980
8 Replies

5. Shell Programming and Scripting

Top 5 biggest file

Hi , I need to get a list of name and size , of the the top 5 biggest file under the current directory , in decending order Thank You (4 Replies)
Discussion started by: yoavbe
4 Replies

6. UNIX for Dummies Questions & Answers

sort biggest most recent files

if i am in /tmp file, and i have a few DIRs under /tmp. i want to find the biggest and most recent files (from 7 days ago) in /tmp and subfolders. (3 Replies)
Discussion started by: tjmannonline
3 Replies

7. Shell Programming and Scripting

finding biggest number

I think my script is working but i am trying to understand while I am tracing to see if it's realli working.. can somebody please comment.. also. is there different way to write this in shell? sh -x findbiggestnum 1 2 3 + big=0 + big=1 + big=2 + big=3 + echo 3 3 big=0 ... (3 Replies)
Discussion started by: hankooknara
3 Replies

8. Solaris

top biggest files

hi all, is there any way how i can output the top 10-30 biggest files for all filesystem? using du -sh * is quite tedious since i have to move from 1 directory at a time. thanks (3 Replies)
Discussion started by: 3rr0r_3rr0r
3 Replies

9. UNIX for Dummies Questions & Answers

The biggest newb ever...

Hi, all you unix people. I am a pretty advanced windows user, but I am curious about unix. Is there any reason I should attempt to acquire some form of unix for my home computer system? What sort of things is unix useful for? Unix is open source, right? Assuming that to be the case, I infer that... (3 Replies)
Discussion started by: BoneMalone
3 Replies
Login or Register to Ask a Question