Customizing Your Shell¶
Try and choose one shell¶
shell is the main interface for us to interact with the system. There are various shells, and they are highly customizable. Please try some of them, and find the best one for you.
Shell |
Description |
---|---|
bash |
default one on most systems |
zsh |
slightly more sophisticated (recommended) |
fish |
relatively new one |
Warning
You can use fish if you want to but be aware that it uses a slightly different syntax from bash and zsh. In the next tutorial, only the bash and zsh syntax will be illustrated.
Installation on Ubuntu¶
bash:
It should already be installed on your system. But if it is not, you can install it with the following command:
$ sudo apt install bash
zsh:
$ sudo apt install zsh
fish:
$ sudo apt install fish
Change your default shell¶
Please use the “chsh” command (change the default shell from bash to zsh):
$ chsh
Password:
Changing the login shell for student
Enter the new value, or press ENTER for the default
Login Shell [/bin/bash]: /usr/bin/zsh
Then, you need to create a new terminal to see the changes (for example, quit the VM using the command exit
and then log in again with ssh
).
Customize your shell¶
There are many customizable factors in shell implementations. We invite you to try it on your own. However, as an example, we explain how to add autocompletion to the zsh shell, in this section.
First, you need to install “oh-my-zsh” to manage plugins. For this part, enter the following command in your terminal:
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Then, you will to download and install two specific plugins which are “zsh-autosuggestions” and “zsh-syntax-highlighting”. Enter the following commands:
$ git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
Then edit your “.zshrc” configuration file by appending zsh-autosuggestions & zsh-syntax-highlighting to plugins():
$ nvim ~/.zshrc
For example: plugins=(git zsh-autosuggestions zsh-syntax-highlighting)
Note
You can find the line by using the /^plugins
command in neovim.
Finally, you need to update your current environment with the following command:
$ source ~/.zshrc