Setting up WSL
A few months ago I got rid of my old laptop that I had dual booted Linux and Windows on and decided to get something much smaller and much more portable. I managed to find an ex-display 13" HP laptop and hey-ho, my portability increased ten-fold.
However
This tiny-but-mighty bargain has nowhere near enough hard drive space for me to dual boot Linux and I'm too far down the Unix path to even attempt relearning my workflow on Windows.
In walks WSL to save the day
There are so many blog posts about WSL that are based on a way deeper understanding than I have, but the general idea is that it's a Linux OS inside Windows 10 and it means I don't have to dual boot.
Over the last few months I've used WSL in its various incarnations on both my tiny laptop and my desktop PC, using different terminals, settings, configurations etc. And every time I have to reinstall it or just want a clean slate to work from, I have to try and remember everything I did last time I set it all up.
This is a massive waste of time and I always end up forgetting what I did. I've also stumbled across loads of little bugs, the most recent being that the excellent spaceship prompt that I happily use on my work Mac does not get on well with WSL. For whatever reason (probably already documented read/write speed issues) changing directory would take upwards of 7 seconds.
In an attempt to fix this I ended up reinstalling WSL from scratch and loading in different configurations until I found a solution that worked. But setting this all up on two different computers was a massive pain and I really don't want to have to do this again.
The answer
Automation.
Kind of.
I decided to hack together a script that basically automated all the steps I had to take after installing Ubuntu 18 on WSL.
The resulting script and config can be found in a github repo along with instructions on how to run it all and the end result can be seen below:
I decided to use powerlevel10k
as it gave me enough functionality without slowing the whole thing down. I'm also using Windows terminal with the FuraCode Mono Nerd Font as I found these gave me the best experience in terms of nice Powerline symbols and readability.
Inevitable Problems/Bugs
I did have a few problems that I would love someone to solve for me. The main one is that I install zsh
inside the script, followed by oh-my-zsh
. After this step oh-my-zsh
kicks me back out to prompt, requiring me to then run the script again where it can then skip to the following steps and then run through to completion.
It's not a deal breaker but it is annoying.
I hope that if anyone else is using WSL and is needing a responsive and easy to run set up that this can help them.
If you find anything that can be improved or needs fixing, please do raise an issue on Github and I'll give it a look when I get chance.
You can follow me on Twitter at @itsJoshB for occasional ramblings about tech and other things.
Thanks for reading!
Top comments (0)