Reducing disk bloat on the command line

Some handy nix snippets to find which directories are eating into your disk space

Show me it all

First the daddy. Show disk free (df) on all mounts (-h is for (h)uman readable disk sizes)

Show a breakdown

Show disk usage (du) for a file/directory or set

-h Again human readable

-s Value for each file/directory

-c Show a grant total for all

Rather than specify a file or path I usually cd into the directory and use a wildcard:

To sort by size pipe to, err, sort. With the -h option it groups k, m, g together so not actually in true size order but it’s easy enough to see what’s what. Alternatively remove the -h and look at big numbers!

These commands will miss dot files by default. If you need to see them use

Show recent file changes

Want to see the preference files updated when you launched an app? Or can’t remember what you’ve been doing recently? Show files changed in the last 10 minutes.

To widen the net to longer durations, say files updated in the last 10 days use ctime

Time defaults to days but alternative units can be specified:

s: second

m: minute

h: hour

d: day

w: week

Show recent file access

For file access use either amin or atime with similar pattern.

Do  dangerous stuff

Please use without effect of medication. Now you’ve found files that are possibly clogging up space (how about old backup/cache/log files?) with care you can delete files. Warning it’s recursive. You can/should run the command without the -delete to see what’s going to happen first.

Removing ._ files created by Mac OS X

I moved some files to an Ubuntu server and found all files and directories had duplicate ._ versions. Apparently these are created for the OS X finder.

To get rid:

Installing MongoDB on OS X

First grab the binary from this page:

Extract to /opt/ and add the bin path to your .profile

Create /data/db dir

Give it the right ownership

chown /data/db

Now we can startup:

Now the PHP driver (XCode required)

Then add the following line to your php.ini file:


Getting windows running in Parallels 6 to see a site hosted on OS X apache virtual host

1) Use the instructions in Elric’s post, just above, to get things into their default state, and then change the IP range if you need to (I use the 10.x.x.x range for other things, so for Parallels, I use address in the 172.31.x.x range)

2) Launch the Terminal (Applications>Utilities>Terminal) if it’s not already running, and type: ifconfig

3) As joevt stated above “In Mac OS X, the Parallels shared networking interface is vnic0”, so look for a block in the terminal output something like this:


vnic0: flags=8843 mtu 1500

ether 00:1c:42:00:00:08

inet6 fe80::21c:42ff:fe00:8%vnic0 prefixlen 64 scopeid 0x7

inet netmask 0xffffff00 broadcast

inet6 fec0:0:0:fea9::2 prefixlen 64

media: autoselect

status: active

4) Note down the address after “inet” within the block (you’ll note that mine was

5) On the parallels virtual machine, you need to edit the hosts file, which can be found at this path under Windows XP:



6) Add lines corresponding to your sites as configured within apache, which will look something like this:

Code: apache_local

7) For details, you may find some parts of the originally linked article useful, but keep in mind that the options within Parallels changed with version 6, but hopefully the current post will help with that.

Good luck!

Prebinding and zero link – not required after XCode3.0

These dynamic linking technologies have been superceeded in XCode3.0 and greater.

Dynamic linking provides a mechanism to share libraries. The standard C library may be used by most applications so statically linking, essentially compiling those functions into each individual application, is very inefficient.

To allow dynamic loading (often seen as .dyld) the compiler leaves library method calls as stubs. During application launch the dynamic loader parses the stubs and either replaces the stubs with libraries already in memory or loads the library as required. This extra overhead during launch takes time, so prebinding and zero link were devised to keep the benefits of dynamic linking but reduce launch time.

Prebinding involved pre-allocating memory addresses for libraries where each library author would define a memory address unique for that library. A prebound application using prebound libraries during link time would assume those addresses so at launch time all linking is done, resulting in a faster launch time. Since OS 10.3.4 the dynamic loader was optimised to the extent of being at least as fast as prebinding.

Zerolink approached the issue from a different angle. An application built with zerolink would only link enough to get the application off the ground. Only during runtime as unresolved symbols were found would linking occur, as required. Again the time saving involved is no longer beneficial due to the optimised dynamic loader.

In XCode3.0 and above there are still build options for Prebinding and Zerolink but they are ingnored. They are only present to allow sharing of projects with XCode 2.5.

Configuring Snow Leopard as a SLAMP box (Snow Leopard Apache MySQL PHP)

#install xdebug

Enter the “5.3” directory and find the file named “”. You need to move this file to the/usr/lib/php/extensions/no-debug-non-zts-20090626 directory. First, open a new Finder window and press Cmd + Shift + G. Enter /usr/lib/php/extensions/no-debug-non-zts-20090626/ into the prompt that appears and press “Go”. This will open the destination directory in the Finder window. Drag into the destination directory. You may be prompted for your administrator password. If the /usr/lib/php/extensions/no-debug-non-zts-20090626/ directory does not exist, locate the /usr/lib/php/extensions/ directory instead. This directory will contain a directory named something similar to no-debug-non-zts-20090626. Place into that directory instead.
edit php.ini:

Finally I manage to upgrade my AppleTV to 320G

After much drama I finally upgraded my AppleTV to 320G. Had lots of fun with diskutil, gpt and dd and didn’t toast the system disk by mistake. Which was nice.

Setting the shell path on OS X Leopard

Create your .bash_profile document at the root of your home directory as follows:

and add any relevant paths that you may need. Then execute source .bash_profile in the command line. This ensures that changes to the environment made in .bash_profile are registered before you restart the shell.