Computing.Net > Forums > Unix > Search Large Files

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Search Large Files

Reply to Message Icon

Original Message
Name: jamdee
Date: July 16, 2003 at 07:31:09 Pacific
Subject: Search Large Files
OS: Solaris 8
CPU/Ram: e10k
Comment:

Hi,

I'm new to writing unix shell scripts. How do you search for all files over 500g in unix directories?



Report Offensive Message For Removal


Response Number 1
Name: Don Arnett
Date: July 16, 2003 at 08:13:58 Pacific
Reply: (edit)

Look into using 'du'

It displays file sizes for all files/directories in the current directory and all sub-directories.

For each file/directory, you'll get an output line something like:

48 ./filename


The 48 indicates the file size. I believe that it defaults to outputting the size in blocks or something like that, but there are command line options to adjust that.

On my system (linux), -b outputs bytes and -h outputs 'human readable' (ie 50Mb).


I think what you want to do is call du and pipe the output thru grep.

du -b | grep "^500000000000"

The ^ indicates that the number must be the first thing on the line. Adjust the number according to the size you are looking for.


Report Offensive Follow Up For Removal

Response Number 2
Name: David Perry
Date: July 16, 2003 at 10:37:16 Pacific
Reply: (edit)

find / -size -536870912000c


Report Offensive Follow Up For Removal







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home








Do you have your own blog?

Yes
No
I did before
I will soon


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History




Data Recovery Software