ZShell
What is a shell?
The shell is a program that translates human readable words (commands) and converts them into binary data that the Operating System kernel can interpret. The shell can interpret commands entered from the keyboard or a file commonly refered to as a script.
You can access the shell through a terminal program on the local computer or remotely using SSH.
The most popular shells that I am aware of are:
ZSH
Zsh is a shell that builds on shells such as bash, ksh, and tcsh. Zsh offers some useful features such as better tab completion.
Installing Zsh
Windows
On Windows, you would need Cygwin or the newer Windows Subsystem for Linux. Check out a previous post for setting up Cygwin.
macOS
|
|
Linux
On Red Hat family:
|
|
On Debian family:
|
|
On SUSE family:
|
|
Change default shell
Once you have installed zsh, you need to configure it as your default shell.
|
|
Examples
CD shorthand
|
|
In the example above, simply typing the name of a directory into the prompt will take you to that directory in the shell. On other shells such as bash, this would return an error.
Tab completion
|
|
Zsh improves tab completion. Try typing ls
and tab twice. Zsh will display the files and directories that you can interact with and navigate through with arrow keys. It also works with cd
and mk
.
Directory shorthand
|
|
Try entering only a few characters to the paths to a directory you wish to navigate to. Zsh will expand these fuzzy directories and let you navigate with less typing.
Recommended addons
Out of the box, Zsh has a lot to offer and there are a few additions that make it even better.
Oh my zsh
Oh my Zsh is an open-source framework of Zsh plugins and themes.
|
|
or if you do not have the wget
package:
|
|
Once you install zsh, your zsh config file ~/.zshrc
will be modified. This framework makes it easier to integrate the following plugins.
Powerlevel10k theme
Powerlevel10k is a theme for zsh that can be easily selected when you have Oh my zsh.
|
|
Now you should see the powerlevel10k config wizard:
|
|
Plugins
Zsh syntax highlighting
A plugin that easily can be installed when you have Oh my zsh that will highlight syntax that is typed into the terminal.
|
|
Zsh auto suggestions
A plugin that easily can be installed when you have Oh my zsh that will suggest a completed command based on reference from your history.
|
|
Zsh completions
A plugin that contains tab completion scripts that are not yet available in the main zsh release.
|
|
Activate plugins
Update your ~/.zshrc
file in the “plugins” section:
|
|
Activate the plugins:
|
|
Now, when you begin typing, you should see suggestions based on your command history. Valid commands will be green and invalid commands will be red.