Ubuntu on Windows for die-hard windows fans
Tags: wsl, ubuntu, linux, windows
Published: 2019-04-13 16:23:15

---
title: Ubuntu on Windows for die-hard windows fans
published: true
description: 
tags: WSL, ubuntu, linux, windows
---

For the past couple years I have worked entirely in the microsoft stack. Typescript. C#. VB. MSSQL. IIS. Azure. and the list goes on…

But now I’ve joined a new company and they don’t use windows at all. It’s a total paradigm shift. JS instead of TS. Python instead of C#. Postgres instead of MSSQL. Nginx and AWS instead of IIS and Azure.

I could say bye to windows. With thermite and a raft I could give my PC a decent viking burial. Then I would use a macbook air and sit in a coffee shop and say goodbye to ☕ENTERPRISE DEV☕ and become ⚡ROCKSTAR HACKER⚡.

But you know what? Over the years I’ve become a bit fond of windows. It's clunky. It's slow. But I grew up with it, damn it. So……


![Pictured: not what actually happened](https://thepracticaldev.s3.amazonaws.com/i/6c09gh759vkwlaj149uk.png)
Enter WSL, the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10), also known under its much more awkward acronym, BOUOW. With this bad boy you can have a full blown ubuntu system in the same environment as windows! Hooray! Problem Solved!

But not so fast. You still have to learn all the new linux concepts and commands. And get ready for a clown car full of bugs….


![http://pbfcomics.com/comics/honk other comics may be NSFW](https://thepracticaldev.s3.amazonaws.com/i/s25v43incgk0hxawy16m.png)
For starters, let’s assume you installed ubuntu, upgraded it, and have the terminal up and ready to go. Or have shelled out a few bucks for [wlinux](https://www.microsoft.com/en-us/p/wlinux/9nv1gv1pxz6p?irgwc=1&OCID=AID681541_aff_7593_1291904&tduid=%28ir__r3gf2fplu0kfr06u0cigmvmrvu2xm2ozg1wgnbco00%29%287593%29%281291904%29%28%29%28%29&irclickid=_r3gf2fplu0kfr06u0cigmvmrvu2xm2ozg1wgnbco00&activetab=pivot:overviewtab). Next you should find a basic linux terminal tutorial and follow that, getting used to cd'ing to directories, ls'ing to see items, the basic stuff. Once you've mastered the basics you can put some handy dandy aliases in your .profile:

{% gist https://gist.github.com/Almenon/bf97001223830dac961b738e07fb1388 %}

Restart your terminal and test out a alias or two to make sure they work.

Then add a softlink to your windows drive. For me I used the below command:

`ln -s dev /mnt/c/dev`
Now you can cd into your windows dev folder. (you might need to make the dev folder in Windows first)

But be warned, because WSL / windows interoperability is still pretty buggy. I suggest keeping the two systems as separate as possible, even if it means re-installing stuff on your ubuntu subsystem.

If you want to interact with windows from ubuntu regardless, keep these things in mind:

1. If you try doing git status on a windows repo, it will report all the files as modified. To fix this set the following in your repo:
`git config --local core.autocrlf true`
`git config --local core.filemode false`

2. If you ever need to use chmod or deal with permissions in the windows filesystem follow this stackoverflow: https://superuser.com/a/1343737/890079

see [this blog post](https://blogs.msdn.microsoft.com/commandline/2018/02/07/automatically-configuring-wsl/) for more details.
3. you can invoke windows utilities through cmd /C. For example, cmd.exe /C echo hello world . Or you can invoke utilities directly by specifying .exe, like so: ipconfig.exe | grep IPv4 | cut -d: -f2

4. Vice-versa, you can invoke linux utilities on windows through wsl command.

5. Docker doesn’t work well in WSL 1, along with some other miscellaneous feature and apps that don’t function properly. For docker you need WSL 2.

Last of all, if you’re new to linux you probably want a handy reference to look up documentation on linux utilties. There is the man command, of course (man ls to see ls docs) but it can be a lot to read. I would suggest also downloading [cheat](https://github.com/chrisallenlane/cheat). cheat command will give you plenty of useful examples that you can use to quickly get up to speed. For starters, try out cheat grep.

So to sum it all up, is WSL worth the hassle? If you're going to be using WSL primarily, no. I regret not just setting up a ubuntu dual-boot straightaway, and that's what I eventually ended up doing. But if you are working a minority of the time in WSL or just playing around with it, then I would heartily recommend it.

<!--
Then try making a folder.
MKDIR test; ls # linux: use ls instead of DIR
If you've set your umask then the folder should not appear, because it's set to a shade of blue almost invisible to the human eye †. If it appears a nice easy to see green then something might have gone wrong - doublecheck that .bash_aliases is loaded by putting a echo "loaded" in there.
† Windows recently released a update to fix their terrible blue - see https://blogs.msdn.microsoft.com/commandline/2017/08/02/updating-the-windows-console-colors/ and look in comments for a regedit patch
-->