DEV Community

Mat
Mat

Posted on

Turn Windows into a usable development environment with WSL

I recently set up a development environment on my windows computer, using Windows Subsystem for Linux (WSL).

This lets you effectively install a Linux OS on top of windows that works seamlessly with windows tools, and it's so much better than my previous experience of trying to develop on windows.

Basic setup

  1. Install WSL

  2. Install a tabbed terminal (Optional - I expect this will be fixed eventually, but the current default terminal is pretty useless)

  3. Set up Visual Code to work with WSL

  4. Install Docker into WSL

These steps will let you work with Visual Code and terminals, and things will mostly just work as if you were actually working on Linux.

You can also run any Docker command from within WSL (after running apt install docker) and it will use the Docker daemon provided by Docker for Windows.

(Optional) Configure the tabbed terminal

The terminal is a bit fiddly to configure as it requires editing a JSON file. You can open it by pressing CTRL+,

The profile settings look like this:

{
    "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
    "hidden": false,
    "name": "Ubuntu",
    "source": "Windows.Terminal.Wsl",
    "colorScheme": "One Half Dark",
    "fontSize": 15
},
Enter fullscreen mode Exit fullscreen mode

At a minimum I would recommend changing the color scheme. Even after swapping out the terminal app, I found the default colors hard to read against a dark background.

For more info about the options you can refer to the Windows Terminal documentation.

WSL is pretty cool

So far I've been really impressed with how well this all works.

If you want to know more about WSL, I recommend this Hanselminutes podcast: Inside Linux on Windows with WSL and Tara Raj

Windows 10 runs Linux natively! How is that possible? Scott talks to Microsoft's Tara Raj, the Program Manager for the Windows Subsystem for Linux. How does this technology work? Tara explains the internals of WSL to Scott in this episode.

Top comments (4)

Collapse
 
jonrandy profile image
Jon Randy 🎖️

Dear god, just use Linux. I switched years ago and never looked back. Windows feels like a bad dream now

Collapse
 
catmullet profile image
Robert Catmull

Which would be great. I love Linux! My personal machine always runs the latest Ubuntu flavor, but if you have responsibilities in an enterprise organization that requires you use windows for it's desktop office applications you've turned Linux into a bad dream trying to be compatible with everyone else. This is a life saver. Just because an article isn't relevant to your circumstance doesn't mean it's a bad idea.

Collapse
 
joreispy profile image
JoreisPy

I completely agree, I am forced to use windows at work even though I full admin rights, so I have setup wsl for my dev projects. I am so happy with the flexibility it provides, having all the necessary windows apps plus a wonderful bash terminal!

Collapse
 
fquinner profile image
fquinner

This really is the future imo. Windows terminal is awesome too huge advances in the last couple of years.