From: Brian Gordon on
I'm running Tiger (10.4.11) on a Powerbook with a 100G disk. I've just gotten
a message that the startup (and only) disk is almost full. GetInfo reveals
that there are only a couple of K open!

I'm sure some runaway process has created a HUGE file -- several G at least. I
remember 'find' being useful in such situations in the past, but it's been too
long ago.

Can someone recommend a 'find' command to locate giant files? Thanks.

--
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Brian Gordon -->briang(a)panix.com<-- brian dot gordon at cox dot net |
+ Bass: Lexington "Main Street Harmonizers" chorus +
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
From: Ian Gregory on
On 2010-07-17, Brian Gordon <briang(a)panix.com> wrote:

> I'm running Tiger (10.4.11) on a Powerbook with a 100G disk. I've
> just gotten a message that the startup (and only) disk is almost full.
> GetInfo reveals that there are only a couple of K open!
>
> I'm sure some runaway process has created a HUGE file -- several G at
> least. I remember 'find' being useful in such situations in the past,
> but it's been too long ago.
>
> Can someone recommend a 'find' command to locate giant files? Thanks.

To find files in the current directory that are bigger than one
gigabyte:

find . -size +1G

To search the whole filesystem you may need sudo to give you permission
to read all directories, and you just give "/" as the path instead of
".", like so:

sudo find / -size +1G

I just ran it on my 10.6.4 iMac. It took a couple of minutes and only
came up with two files, both in "Movies" in my home directory.

Ian

--
Ian Gregory
http://www.zenatode.org.uk/
From: Jolly Roger on
In article <i1si1l$2er$1(a)panix2.panix.com>,
briang(a)panix.com (Brian Gordon) wrote:

> I'm running Tiger (10.4.11) on a Powerbook with a 100G disk. I've
> just gotten a message that the startup (and only) disk is almost
> full. GetInfo reveals that there are only a couple of K open!
>
> I'm sure some runaway process has created a HUGE file -- several G at
> least. I remember 'find' being useful in such situations in the
> past, but it's been too long ago.
>
> Can someone recommend a 'find' command to locate giant files? Thanks.

Why bother with command-line stuff when there are GUI utilities that
show you, visually, which files and folders on your disk are taking the
most space? One of the best GUI utilities for visually seeing where you
disk space is being used is a treemap program.

Grand Perspective is one such application for Mac OS X:

<http://grandperspectiv.sourceforge.net>

Disk Inventory X is another (requires Rosetta):

<http://www.derlien.com/>

And if you don't mind paying a little for it, DaisyDisk is probably the
coolest version of such a utility I've ever had the pleasure of using:

<http://www.daisydiskapp.com/>

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
From: Bob Harris on
In article <i1si1l$2er$1(a)panix2.panix.com>,
briang(a)panix.com (Brian Gordon) wrote:

> I'm running Tiger (10.4.11) on a Powerbook with a 100G disk. I've just
> gotten
> a message that the startup (and only) disk is almost full. GetInfo reveals
> that there are only a couple of K open!
>
> I'm sure some runaway process has created a HUGE file -- several G at least.
> I
> remember 'find' being useful in such situations in the past, but it's been
> too
> long ago.
>
> Can someone recommend a 'find' command to locate giant files? Thanks.

I like OmniDiskSweeper (free download)
<http://www.versiontracker.com/dyn/moreinfo/macosx/8667>


If you want to say with Unix commands, then maybe you want to look
at the 'du' command which will tell you how much storage is under
each directory/subdirectory. Kind of what OmniDiskSweeper is
doing, except minus the nice GUI interface.



If you really want to use script, here is what I use to find big
files on my system:

#!/usr/bin/env bash
#------------------------------------------------------------------
------------
# findbigfiles.sh - find files on / that are greater than the
specified size.
#
# Usage: findbigfiles.sh # Find files allocating more than
50MB
# findbigfiles.sh size # Find files allocating more than
'size'
# # 123 (bytes) - 123
# # 123K (kilobytes) - 125,952
# # 123M (megabytes) - 128,974,848
# # 123G (gigabytes) -
132,070,244,352
# findbigfiles.sh size dir [dir ...] # start looking with
'dir'
#
# It helps to be root when you do this.
#------------------------------------------------------------------
------------
# Bob Harris
#------------------------------------------------------------------
------------
THRESHOLD=${THRESHOLD:-50M} # Select files allocating more than
this
VOL=/
[[ -z "$OSTYPE" ]] && OSTYPE=$(uname)
[[ $OSTYPE = *[Ss]olaris* || $OSTYPE = *[Ss]un* ]] && export
MYAWK=/usr/xpg4/bin/awk

e() { echo 1>&2 "$*"; }
usage()
{
e ""
e "Usage: findbigfiles.sh # Find files allocating more
than ${THRESHOLD}"
e " findbigfiles.sh size # Find files allocating more
than 'size'"
e " # 123 (bytes) - 123"
e " # 123K (kilobytes) - 125,952"
e " # 123M (megabytes) -
128,974,848"
e " # 123G (gigabytes) -
132,070,244,352"
e " findbigfiles.sh size dir [dir ...] # start looking
with 'dir'"
e ""
exit 1
}

if [[ X$1 = X-h* ]]; then
usage
elif [[ X$1 = X-* ]]; then
usage
fi

if [[ $# != 0 ]]; then
THRESHOLD=$1
shift
fi
if [[ $# != 0 ]]; then
VOL="$*"
fi

T=${THRESHOLD}
[[ ${T%[kK]} != ${T} ]] && T=$((${T%[kK]} * 1024))
[[ ${T%[mM]} != ${T} ]] && T=$((${T%[mM]} * 1024 * 1024))
[[ ${T%[gG]} != ${T} ]] && T=$((${T%[gG]} * 1024 * 1024 *1024))
THRESHOLD=${T}

find 2>/dev/null $VOL -xdev -type f -size +${THRESHOLD}c -print0 |\
xargs -0 ls -lds |\
${MYAWK:-awk} -v threshold=$THRESHOLD '
$1+0 <= (threshold/1024) { next }
{
size = sprintf("%d", $1);
n = split(size,a,"")
size = ""
c = 0
for(j=n; j > 0; --j) {
if ( c % 3 == 0 && c != 0 ) size = "," size
c++
size = a[j] size
}
if ( $9 !~ /:/ ) $8 = $9
printf("%12sK %3s %-4s %s\n", size, $7, $8, $NF)
}
'
 | 
Pages: 1
Prev: DU and Partition Map
Next: Apple iPhone 4 issues