Marc Goldberg's Blog
Bash hostname completion in OS X

If you use Darwin Ports to get various open source utilities on your Mac, make sure to add bash-completion to your must-have list.  It configures programmable command-line parameter completion in much the same way tab-file-completion works.

It’s useful immediately out of the box in many ways, the most significant of which for me is the ssh/scp/etc hostname completion.  Any hostname that’s in your ~/.ssh/known_hosts file can be tab completed.

port install bash-completion
echo ". /opt/local/etc/bash_completion >> ~/.profile"

That’s it!

OS X Server 10.5.4 Open Directory bug - Workaround

Geek alert: skip this if you don’t administer Open Directory on OS X Server Leopard (10.5.2 thru 10.5.4 as of this writing).

Regarding this Open Directory critical bug (Apple problem ID #5935780):

If you happen to have a terminal window open with root logged in you can killall -ILL DirectoryService to force OD to crash and restart (and shame for leaving a root shell open :-).

Slightly more sane is a regular launchd job to prophylactically restart OD using the same command.  Lingon is a great resource if you don’t know how or want to bother figuring out how to create a new launchd job.

If you happen to experience this bug, PLEASE report it to Apple!