Photo by Mia Baker on Unsplash

The Z shell

Ria Cataquian
3 min readSep 24, 2017

--

Z shell is an advance shell for *nix. It is what most of us know today as Zsh.

I won’t go deeper with the installation process. I would just want to share how efficient Zsh is as an interactive login shell and probably share some useful commands. Check out oh-my-zsh to manage your Zsh configurations and more.

As software developers, we spend majority of our time in a terminal. Our work usually involves a lot of shell interaction. All the more reason to boost our shells all set for productivity and convenience. Zsh is one of those tools I feel productive when using. Here are some features I enjoy:

Better tab completion..

Bash shell
Zsh shell

I can navigate through the suggestions and tab my way through each. Omitting cd also works.

Pre-installed git plugin and more

My commonly used commands in git
…and more: https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins

Zsh also goes better with remembering and sharing history across multiple terminals. This is immensely useful since you won’t have to remember which terminal you’ve typed a particular command. Just press the <UP> arrow key, and navigate through the recorded commands. Type some keyword/prefix to trim your list like, ls <UP> which should suggest me with the list of ls commands I have recently fed in. There’s also <ctrl+r> to search through command history and <ctrl+g> to exit search mode.

File and directory globbing also is extensive to Zsh.

http://zsh.sourceforge.net/Intro/intro_2.html for more info

It is also worth noting that Zsh supports shorthand ls. Typing /u/l/bi also works for me, it will cd me to the /usr/local/bin/ directory.

Additionally, Zsh provides inline documentations for several commands such as rake, ls, ssh, etc.

Double tab to navigate through each commands

Moreover, Zsh because of its better git support! It shows what branch I’m currently working on and display an indicator if there are uncommitted files.

These are just some of the cool stuff Zsh offers that I frequently use. Another way I leverage it (though not unique to Zsh), is by declaring aliases. Aliasing boosts productivity since it reduces the amount of keystrokes you’ll need to carry out a command. Some of it were pre-installed when you install Zsh. Like for example, I mentioned about git plugin. Type alias into your directory to see the aliases Oh-my-zsh defined for you. Key in alias | grep <keyword> to trim it down. Furthermore, you may define aliases in your .zshrc file.

Other useful shortcuts (not exclusive to Zsh):
!! to view last typed in command (or just press the <UP> arrow key)
<ctrl + a> to move at the beginning of the line
<ctrl + e> to move at the end of the line
<ctrl + u> to clear the current line (note that in bash, it will clear all characters before the cursor position)
<ctrl + k> to clear all the characters that precedes the cursor position
<ctrl + l> to clear the screen

That’s it! Hope I shared something useful. Thank you for taking the time to read. As always, happy coding! :)

--

--