I 💘 BASH, I used it every day since 1999 👨‍🎓👨‍💻. But ZSH looks so nice and after giving it a proper shot, using it for a day in January 2019, I fell in love with it.

Tab completion with documentation


Kill with tab completion


Auto suggestions


Emacs/BASH like navigation

Pressing M-f and M-b navigates differently than in BASH or in Emacs, e.g. pressing M-f when the cursor (|) is on curl:

|curl -u admin:admin http://foo-world.com 

it jumps to after -u instead of after `curl:

curl -u| admin:admin http://foo-world.com

To remedy this, I've set this in my .zshrc:

autoload -U select-word-style
select-word-style bash

Now, I get Emacs/BASH like navigation, hitting M-f here:

|curl -u admin:admin http://foo-world.com

takes me to:

curl| -u admin:admin http://foo-world.com

just like I wanted too 😄

Forgetting a pipe

$ bash
$ echo hi |
> wc
$ zsh
$ echo i |
pipe> wc

Forgetting a quote

$ bash
$ echo 'hi
> '
$ zsh
$ echo 'hi
quote> '

Shows you if command will be found


Powerful recursive file name matching


BASH has this too, albeit not enabled by default

$ ls ~/.m2/repository/org/**/*.pom | tail -n 3
ls: cannot access '/home/torstein/.m2/repository/org/**/*.pom': No such file or directory
$ shopt -s globstar
$ ls ~/.m2/repository/org/**/*.pom | tail -n 3

Closing a shell where you've started an app

Unlike BASH, you must disown the process(es) you've started in the shell, before closing it:

$ firefox &
$ disown %firefox
$ exit

Fortunately, zsh gives you auto completion on the jobs to diswown, still it's more cumbersome than bash and dash.

Pure prompt


Fancy prompts with things like git status in them are more snappy than in bash. I suspect this is because ZSH executes those fancy prompt functions on a separate thread and then decorates your prompt when it has gotten the data it needs.

Can re-use BASH aliases

In both my .bashrc. and .zshrc, I've got this line:

source $HOME/.bashrc.aliases

Setting up ZSH on Debian

# apt install fzf
# apt install zsh
# apt install zsh-autosuggestions
# apt install zsh-syntax-highlighting

My .zshrc

My .zshrc can be found here.

Licensed under CC BY Creative Commons License ~ ✉ torstein.k.johansen @ gmail ~ 🐦 @torsteinkrause ~