WSL / Ubuntu / ZSH and Hyper Terminal
I’ve been using Windows Subsystem for Linux for quite a long now.
What is Windows Subsystem for Linux? It’s basically to run a Linux environment in Windows OS
Even if it wasn’t really stable at the beginning, a lot of improvements have been made.
At work I have quite a lot of work and users support tasks which need to be done in a Windows environment, that’s why I’m mainly working in a Windows environment. Of course I have some stand-alone or managed VM (with Vagrant) for development purpose, however I don’t always want to boot up a Linux VM to do some minor changes.
Before WSL exists, I have tried Cygwin and Babun but it felt clunky compared to a real Linux environment, especially for packages installations/updates.
Now if you are using W10, big chances you have already WSL installed.
Install & Configure WSL
If not, you can enable it here:
1) Launch Add or remove programs
2) On the left in the section Related settings, open Programs and Features
3) A new window shows up, click Turn Windows features on or off
4) Find in the list Windows Subsystem for Linux and enable it
Once WSL installed, reboot and launch bash.exe
or wsl.exe
to start a new shell.
A welcome message appear and warn you that no Linux OS is actually installed.
You can click the URL in the message to download Ubuntu as a default WSL OS.
Other OS are supported now, you can check available OS in the Windows Store.
It can take some time to download and install the OS image based on your internet connection.
When done, you should have access to a terminal with a shell session (Bash by default).
By default WSL is intalled on your Windows partition and depending on the packages you install, this can take a lot of space on your hard disk. Unfortunately, for the moment it’s not possible to choose on which partition you want to install WSL during the installation. My Windown OS is actually installed on a SSD and I don’t have so much space, so I try to be careful on what package I install.
Setup ZSH and oh-my-zsh
ZSH
To install ZSH run the following command in the terminal you launched previously (bash.exe
):
sudo apt-get install zsh
Make ZSH your default shell:
chsh -s $(which zsh)
oh-my-zsh
Using cURL:
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
or
Using wget:
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
and follow the instructions.
Beware at the end of the installation process, you may be asked to add some code to your
.zshrc
file.
Better terminal - Hyper Terminal
As you may noticed, the default cmd
like terminal is very limited. No split, no tabs and not some many other options.
That’s where Hyper Terminal enter in the Game.
You can directly download it from the:
Website: https://hyper.is/
GitHub: https://github.com/zeit/hyper
or even chocolatey.
I use also tmux with ZSH for pane split and tabs support but is not as easy as Hyper to configure.
By default Hyper create a config file into:
C:\Users\your_username\.hyper.js
You can find my .hyper.js
configuration in my dotfiles repo on GitHub.
Setup those lines in you .hyper.js
config file to execute ZSH by default and start the shell in your home directory:
// Powershell on Windows
// - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
shell: 'C:\\Windows\\System32\\wsl.exe',
// for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
// by default ['--login'] will be used
shellArgs: ['~'],
Also here, a very nice curated list of Hyper plugins:
https://github.com/bnb/awesome-hyper
If you have some questions or wanna share some improvements, feel free to drop a comment