oh my zsh is a very good configuration framework based on zsh, it can simplify a lot of daily operations of Linux end users. Moreover, its interface is very nice compared to the original bash. This article describes how to install and configure oh my zsh and its common plugins under Ubuntu.
oh my zsh Installation and Basic Configuration
Before installing oh my zsh, you need to install git, curl and zsh by running the following commands.
% sudo apt install git curl zsh
After installing the dependent items, you can directly execute the following commands to install them with one click:
% sh-c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Set zsh as the default shell:
% chsh
Follow the prompts step by step and type /bin/zsh.
Common Plugin Installation
Configuring oh my zsh by itself is not enough, you may need the following commonly used plugins to really achieve the goal of simplifying operations.
- z Historical directory management
- zsh-autosuggestions command prompt
- zsh-syntax-highlighting highlighting
- sudo When you forget to add the sudo prefix
- extract Extracts almost all installers in one command
z
No need to install additional packages, just fill them out in the plugins.
zsh-autosuggestions
Execute the following command first, and then fill in the plugins.
% git clone git://github.com/zsh-users/zsh-autosuggestions $ {ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
zsh-syntax-highlighting
Execute the following command first and then fill in the plugins.
% git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ {ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
sudo
No additional installation is needed, just fill in the plugins.
extract
No additional installation is needed, just fill in the plugins directly.
Setting up proxies
We can enable the switchable proxy functionality by adding the following configuration to .zshrc:
proxy() { export https_proxy=http://127.0.0.1:1234 export http_proxy=http://127.0.0.1:1234 export all_proxy=socks5://127.0.0.1:1234 } unproxy() { unset https_proxy unset http_proxy export all_proxy }
You can change 1234 to any port you want.
Refreshing the Configuration
Execute the following command to refresh the configuration.
% source ~/.zshrc