How to setup a nice looking terminal with WSL in Windows 10 Creators Update
Tutorial on how to get a nice looking terminal like this
instead of just bash in the usual cmd.exe window like this
Start by making sure that you have installed WSL according to these instructions: https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
Now, you should be able to launch bash by starting cmd.exe and typing
bash
From here you can do all the normal terminal stuff like ls, but as you see, the colors aren’t really that exciting. Actually, they are quite hard to see.
To fix this, download this software: https://github.com/goreliu/wsl-terminal
This terminal emulator fixes some great things about the default Windows terminal, including adding support for color themes. Open the terminal, right click on top and go to Options, Looks and finally change the Theme. Here you can choose whichever one you feel like, but base16-solarized-dark.minttyrc is the one I prefer.
Now, lets get on to improve the shell. This great tutorial explains how to install Zsh: https://www.howtogeek.com/258518/how-to-use-zsh-or-another-shell-in-windows-10/
Let’s take it one step further and install Oh-my-zsh to improve shell functionality even further! Use this great guide for that: https://www.smashingmagazine.com/2015/07/become-command-line-power-user-oh-my-zsh-z/#use-zsh-and-oh-my-zsh
Now, I prefer to use the Agnoster theme, but as you see, without the correct fonts this looks pretty bad.
Easy peasy, just hop over to https://github.com/powerline/fonts and download whatever font you want. I use the DejaVuSansMono for Powerline font, which you can get here: https://github.com/powerline/fonts/tree/master/DejaVuSansMono
Just download the ttf file that you want and double click to install. Then change the font in wsl-terminal to whichever one you chose. The terminal should now look something like this:
Ok, prompt is fine, but we need to do something about the colors in ls. So let’s hop over to https://github.com/seebi/dircolors-solarized and download or clone the repository.
Now, to your .zshrc file (which you changed when chose what theme to use), simply add this line:
eval `dircolors ~/Git/dircolors-solarized/dircolors.256dark`
The path should of course correspond to the actual location where you downloaded the repository to. Now when you start your terminal and run ls, it should look something like this:
One last thing, because WSL makes all windows files executable and because ls colors executable files in a specific color regardless of filetype, the coloring is not perfect when looking at windows files. I have not figured out a way to solve this that doesn’t involve recompiling ls. So my solution was simply to change the row in dircolors.256dark that reads
EXEC 00;38;5;64
into
EXEC 00;38;5;244
It’s not perfect, but it makes the output slightly nicer to look at.
If you have any questions, thoughts or suggestions on how to make this better, please leave a comment!