Bash facelift – zsh with Powerlevel9k
Where’s the web server configuration again? Am I even in the right branch? Is it home time yet? Complete the following tutorial to find answers to these and many other questions of life with a glance in the command line.
Step 1: Install zsh and Oh-My-Zsh
The Z-Shell (or zsh for short) is an interactive shell with a long list of features that can greatly simplify life in Linux. Combine with Oh-My-Zsh, a framework for simple management of the zsh configuration, you get a powerful tool that you will soon learn to appreciate and perhaps even love.
Install zsh
The installation guide is for Debian (e.g., Ubuntu) based systems —see here for more information for other Linux distributions, Mac OS and Windows.
Sudo apt install zsh
Set as the default shell
chsh -s $(which zsh)
Install Oh-My-Zsh
sh -c "$(curl -fsSL raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Step 2: Customize the theme, plugins, etc.
If the default theme doesn’t appeal, you can select another from a list of countless options. There are also countless plugins for many other purposes. Both can be adjusted using the configuration variables ZSH_THEME and plugins under ~/.zshrc in the zsh configuration.
Step 3: Fancy icons and custom prompt
Give the console the finishing touch by installing a few Powerline fonts with their own icons to enhance the clarity of the command line and minimize it to those actually used. See “Config” for the entire configuration as shown above.
Install Powerline fonts
Or alternatively
https://github.com/gabrielelana/awesome-terminal-fonts
Step 4: Familiarize yourself with—and learn to love—the features
Zsh has a ton of features that can save you a lot of time in everyday work. There is no need to worry about losing the commands you have used so far, as Z-Shell and Bash only differ minimally in their compatibility. Scripts should still be carried out using /bin/bash, as this is the distribution-wide standard.
Global command history
The intelligent command history can be used across all shells and there is also an intelligent autocompletion command [search term + ].
Kill processes interactively
The normal kill command also offers autocompletion [kill + search term + ].
Aliases, aliases, aliases
All configured aliases can be called up using the [alias] command. New aliases can be added via alias -g gp=‘Pipe grep -i’.
Globbing
There is no longer any need for lengthy searches using [Find]. A recursive search can instead be launched using ls **/testfile, for example. See here for a complete list of all glob operators.
Z and autocompletion
The Z plugin enables switching between different folders without knowing exactly where the folder is located. This works really well and dynamically adjusts to the frequency of call-ups. What’s more, intelligent autocompletion is offered here that can either be selected in advance using [Tab] or performed at random using [Enter] (pretty reliable from 2-3 letters). Further autocompletion plugins for different tools (e.g., Maven or Docker) can easily be activated plugins=(mvn,docker).
Comments
No Comments