Having moved away from development of Ansible/Python/Terraform, and others on Windows a few years ago. I’ve heard that WSL has become much better, especially with its support of VS Code now that they have a WSL connector. So, I decided to give it a try.
However, I did run into one surprising inconvenience, BASH! I have become so accustomed to ZSH over the years on Apple and using oh-my-zsh that all my shortcuts and quick ways to doing things just weren’t there.
I did attempt to use oh-my-bash but there just aren’t the number of plugins already to support the plethora of plugins I need and use on a regular basis. So, next logical step is to install ZSH on my WSL: Ubuntu system.
Requirements
WSL with Ubuntu installed
Steps to install ZSH
- Install ZSH.
1sudo apt install zsh123456789101112131415eanderson@MATRIX-WINDOWS:~$ sudo apt install zsh[sudo] password for eanderson:Reading package lists... DoneBuilding dependency tree... DoneReading state information... DoneThe following additional packages will be installed:zsh-commonSuggested packages:zsh-docThe following NEW packages will be installed:zsh zsh-common0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.Need to get 4794 kB of archives.After this operation, 18.2 MB of additional disk space will be used.Do you want to continue? [Y/n] - Verify that ZSH has been installed on the system.
1zsh --version12eanderson@MATRIX-WINDOWS:~$ zsh --versionzsh 5.8.1 (x86_64-ubuntu-linux-gnu) - Set ZSH as your default shell.
NOTE: This used to require modifications to the shortcut to access WSL but in newer versions of WSL you can use the following.
1chsh -s /bin/zshFor older versions you will need to modify the shortcut to WSL and use the command:
1%systemroot%\system32\bash.exe ~ -c /bin/zsh - Once you close and reopen your WSL Ubuntu shell you should now be in ZSH shell.
Install of Oh-my-zsh
- Ensure that your terminal session is open and use the following command as per https://ohmyz.sh/#install
1sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" - You should now be able to configure your oh-my-zsh installation by modifying your .zshrc file and enable any plugins you need.
- The final result! 🙂Â
Hopefully that helps, I know it helped me as I venture back to Windows for development of my Ansible playbooks and other tools.