Bash: Resolving Symlinks to Shellscripts

Here's a way to resolve symlinks that call a bash shellscript. The Problem I like to be able to use something like this in my bash scripts: SCRIPTDIR=$(dirname $0) Which is great for a reference to where the script is, but it suffers from the problem that if you…

Linux: Changing UIDs and GIDs for a user

Just had to do a quick switch over of UID and GIDs for a couple of users. I'm using Puppet to manage server configurations and it's got some nice features for automating the set-up of users. Unfortunately when I initially set-up the puppet directives, I overlooked setting the UID for…

Mac OSX tip: ls command color output

If you have OSX tiger simply grab the fileutils from fink with fink install fileutils Then add the following to your .profile: export LS_OPTIONS='--color=auto' eval "`/sw/bin/dircolors`" alias ls='ls $LS_OPTIONS' alias ll='ls $LS_OPTIONS -lah' alias l='ls $LS_OPTIONS -lA' In leopard…

Extracting a single file from a tar backup

Like an idiot I accidentally overwrote a file for this blog when uploading some other stuff; accidents happen. Anyway, I have backups (you do have backups right?) and I needed to grab a single file out of the latest tar. Fortunately this is really straight forward and rather than unpacking…