Are You Still Using CMD? Let Me Introduce You to WSL

If you are new to web development and your PC is Windows, surely you have watched several courses or tutorials in which their instructors had a terminal that looked something like this: 🤩

Awesome Terminal

Or ran commands such as clear or ls, which you tried to run in your terminal, but they did not work and printed an error. Well, if you have those issues, let me tell you that you’re using the wrong terminal. 😅

CMD

You may think these are just unimportant details, but there is nothing further from reality.

As a popular saying says: The terminal is a developer’s best friend. 💙

Hi! I’m Ernesto, and in this post, I am going to teach you how to get all the power 💪 of a Linux terminal inside Windows (without disk partitions).

What is WSL?

Before we begin, we should talk about what WSL (Windows Subsystem for Linux) is.

WSL is a compatibility layer developed by Microsoft for running Linux binary executables natively on Windows 10. In simpler words, it allows us to install real Linux distros, like Ubuntu, all inside Windows. This means we can use tools like bash or zsh to manage our Windows files. 🤯

With WSL, we can run Adobe Photoshop or Microsoft Word in a window and Ubuntu in another. All at the same time!

Install WSL

To install WSL, you must match these requirements:

  1. Have Windows 10 installed
  2. Have, at least, 1607 version for WSL 1 and 1903 for WSL 2
  3. Have virtualization enabled (for WSL 2)

To see your Windows version, follow these steps:

  • Press Windows + R.
  • Write winver and press enter

To enable virtualization, watch this video.

Enable WSL

Open PowerShell as administrator and run this command.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

When the process finishes, restart your computer.

Install a Linux Distro

Open Microsoft Store and search “Linux”. You can install the distro of your preference, but if you’re not sure, I recommend you choose Ubuntu.

Microsoft Store

When the installation finishes, open Ubuntu and wait until the installation ends. After that, write a new UNIX username and password.

Add UNIX username and password

Don’t forget to save your information in a secure place.

Update to WSL2

It is the second version of WSL. It increases file system performance and supports full system call compatibility.

If you want to read a full comparison between versions 1 and 2, read this blog from Microsoft.

For this step, it is mandatory to match all requirements for WSL 2 I mentioned at the beginning of the installation. If you don’t match the requirements skip this step and go to the next one.

Before updating, check your current version by running the following command in PowerShell:

wsl -l -v

This command will show all distros we have installed and the version of WSL they are running in.

WSL version

Enable VMP (Virtual Machine Platform)

Now, to enable VMP, you have to run this command in PowerShell:

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Once the process finishes, restart your computer.

Install the Linux Kernel

Download the kernel from this link, execute the installer, and accept all permissions.

Set WSL 2 as the Default Version

Run the following command in PowerShell:

wsl --set-default-version 2

With this configuration, all distros you install are going to run in WSL 2.

If you already had a distro installed, you must update it manually with this command:

wsl --set-version Ubuntu 2

Install Windows Terminal

It is an application developed by Microsoft that makes working with multiple terminals easier.

Microsoft Store

In the Microsoft Store search for “terminal” and install it. Once the installation finishes, open the Windows Terminal app and select the Ubuntu (you can select PowerShell, CMD, or Azure too).

And there you have it! You have, now, WSL installed on your computer. 😎

WSL — Ubuntu installed

Next Steps

Congrats! ⭐ You can now use all the power the terminal has to offer inside your Windows computer without the need for a disk partition. 🤩 However, we still have a problem. The terminal looks kind of ugly. 😥

Well, no worries! In this post, I teach you how to make your terminal look awesome. All thanks tozsh and oh-my-zsh. 😉

Thanks for reading! 📖 If this post helped you, please give it a clap. 🖐 And let me know if you have any contribution, comment, doubt, or recommendation. It helps me a lot to improve my content. 😃

See you in the next post. 👋

Originally published at https://ernestoangulo.hashnode.dev.

Just someone who likes design 🎨 and code 💻. Systems Engineering student. https://dribbble.com/netosym

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store