The joys of ZSH! (Re: What we're doing with FreeBSD (was Re: Newbies or trolls?))

James O'Gorman james at jamesog.net
Tue May 16 20:43:37 BST 2006


John Murphy wrote:
> Geraint Edwards <gedge-lists at yadn.org> wrote:
> 
>> John Murphy <sub02 at freeode.co.uk> said
>> 		(on Tue, May 16, 2006 at 04:34:25PM +0100):
>>> I keep finding new wonders: tcsh's 'tab' file name completion was always
>>> quite impressive, but I only just realised it works in the ftp client as
>>> well.  Its history mechanism is very fine,
>> As an ex-tcsh user, (then sh, then bash, then ksh, now zsh) can I
>> implore you to ditch anything C-shell-related and "upgrade" to
>> Bourne shells - and, particularly, zsh.
> 
> Thanks for the suggestion.  tcsh is always there though and seems to do
> everything I need very well.  I'll certainly have a look at zsh docs
> though, in case there's some feature I can't live without.

I too feel the need to wax lyrical about zsh. I've never been more
impressed with something so 'simple' as a shell! You can virtually lean
on the tab key and it will do everything for you.

Someone on IRC once said, "I'm afraid of using zsh in case I hit tab too
many times and delete everything" :-) (Of course, you can't *actually*
do that, but it is very powerful).

Also the command completion is _way_ better than bash's. The couple of
times I tried bash's command completion, it was seriously slow. zsh
takes it all in its stride! You can even do scary stuff like "scp
server:/some/dir<TAB>", and it'll either ask for your password or use
your key, and complete dirs from the remote host!

Oh, and you can do way cool stuff with PS1 too:

jamesog at starbug ~ % head -8 .zshrc
_BLUE=$'%{\e[1;34m%}'
_LBLUE=$'%{\e[1;36m%}'
_GREEN=$'%{\e[1;32m%}'
_RED=$'%{\e[1;31m%}'
_WHITE=$'%{\e[0m%}'

PS1="${_GREEN}%n${_WHITE}%B@%b${_RED}%m ${_BLUE}%5(~|%-1~/(..%)/%2~|%~)
${_LBLUE}%#${_WHITE} "
RPS1='%* %D'

See that %5(~|%-1~/(..%)/%2~|%~) bit? That formats the path in the
prompt, so that you see a ~ in your homedir, but will display no more
than 5 parts of a path (%5). If you go 5 levels deep, it truncates it:

jamesog at starbug ~ % cd /www/sites/netinertia.co.uk
jamesog at starbug /www/sites/netinertia.co.uk % cd www
jamesog at starbug /www/sites/netinertia.co.uk/www % cd htdocs
jamesog at starbug /www/(..)/www/htdocs %

Now *that* I love!

Going back to the secondary vein of the thread, I've been using FreeBSD
for around 5 years (first experimented with 4.4-RELEASE, but didn't
start using it seriously until around 4.7 or 4.8). I eventually switched
my servers from Debian 3.0 (the only Linux worth using as a server,
IMHO) to FreeBSD. I now have a Dell PowerEdge SC1425 sitting in RedBus
running 6.0, doing DNS/mail/web stuff, a 5.4 box at home taking backups
from the RedBus machine and part-time development machine (this will be
going up to 6.1 at some point), and a shiny new ThinkPad X60s which dual
boots FreeBSD 6.1 and Win XP (sadly the wireless doesn't want to play
ball in FreeBSD, even with NDISulator, so I need XP for now...).

Also have a Soekris net4501 running m0n0wall which acts as the NAT
gateway at home. Nice bit of kit :-)

Since I made the switch from Debian, I've honestly never looked back.
It's a much easier system to administer, and works wonderfully most of
the time (hey, nothing works 100% all of the time). Things like the base
system and kernel being a whole, rather than lots of separate things
just seems to make more sense and makes for a much easier upgrade.

James




More information about the Ukfreebsd mailing list