a month with zsh

I’ve been a long time bash user. Back in the day it simply seemed more comfortable than the other options. It’s a workhorse I’ve used for a long time in efforts to automate things away and continue to use for scripting.

Yet, I’ve run into a lot of nitty gritty issues having to do with the various versions of bash I routinely encounter. Then there are wacky things having to do with terminal settings and interactions with tools like screen and tmux. I’ll also lump in my “need” to make my terminal looks “just so.”

I’ve heard really good things about zsh and decided that I had to give it a try.

It’s been about a month and I’ve been using it exclusively on my laptop, where I spend most of my time. I’ve not bothered with going and installing it on all the boxes I touch, since there are too many of them and it seems like poor return on my time to engage in a “comfort” project that broad.

So far I’ve been very pleased and thought I’d share some observations.


This took a little work, since I wanted to maintain most of my stuff from bash and also wanted to make sure that I had the same things in both shells, when I had to switch.

Bash and Zsh like to use different files, but for the most part Zsh is just fine reading a bashrc. So at the bottom of my .zshrc I simply source a generic .profile:

source ~/.profile

That’s pretty much the exact same stuff I had before in Bash and it is also source on login by Bash. That gives me the settings I expect regardless of the shell.

the prompt

Yeah, it’s just a prompt, but I like mine to tell me things. I alsoam a big fan of solarized look and feel. Rather than spending the same amount of time I had invested in getting my Bash prompt right, I came across oh-my-zsh and decided that gnzh looked great and did a nice job for me. The nice thing about that multiline prompt is that when I’m scrolling through output I can quickly see where the commands are.

the commands

While Bash has pretty decent completion, Zsh has it beat. Everyone is likely used to typing a couple letters of a file and hitting TAB to have the rest of the file name filed in. That also works in Zsh, but it also does it with case insensitivity. Not a must have, but definitely nice.

Much of my daily work involves short scripts on the command line. Zsh does a nice job that when I write:

for x in 1 2 3; do

the prompt ends up looking like this:

for x in 1 2 3; do

It’s a very nice reminder of which part of a loop or conditional I’m in, when things get a bit longer.

The command line option completion also seems a bit more complete, but I didn’t study that in depth.

In terms of things I use daily on the command line I’ve not found anything that didn’t work as expect so far. For example the construct of {1..20} works just like bash. The same goes for $(...) and $((4+8)). One thing that is very pleasent is that you can do math with non-integers. This works: $((4.2+5.3)).

Pretty much everything works as it did in Bash and I’ve not come across anything where I had to re-learn things to break old habbits.

Additionally, at least with oh-my-zsh, I got a lot of aliases. The ones I care about are for git and having all that defined is pretty nice. Admittedly, those things are pretty easy to setup and not something I struggled with in Bash, but it’s kind of nice. The other aliases are based on changing directories kind of like using pushd and popd. In Zsh I get these:

-='cd -'
..='cd ..'
...='cd ../..'
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
6='cd -6'
7='cd -7'
8='cd -8'
9='cd -9'

Really the first 3 is where it’s at for me.

The one thing I was surprised by was the peppiness of the shell. I didn’t spent much time thinking about measuring it, but Zsh with features like “watch my git branch” just pop right back. In Bash I would frequently toggle that because it felt sluggish.


Overall, the transition was rather simple and I’ve been quite pleased with the performance, look, and features. I’ll likely end up tweaking my prompt a bit more, but at this point it’s working very well and I’m not going to touch it unless something starts annoying me.

Leave a Reply

Your email address will not be published. Required fields are marked *