The 2mins Read on Window Subsystem for Linux

Asher Chew
4 min readJun 24, 2023

--

How to install a Windows Subsystem for Linux

You can now install everything you need to run WSL with a single command.

  • Open PowerShell or Windows Command Prompt in administrator mode by right-clicking and selecting “Run as administrator”
  • Enter the wsl --install command, then restart your machine.
  • This command will enable the features necessary to run WSL and install the Ubuntu distribution of Linux.

Instructions from Microsoft, read more here: https://learn.microsoft.com/en-us/windows/wsl/install

When you download Linux into Windows using WSL (Windows Subsystem for Linux) with the wsl --install command, you are essentially installing a Linux distribution alongside your Windows operating system. WSL is a compatibility layer developed by Microsoft that allows you to run a full-fledged Linux environment directly on your Windows machine, enabling you to access the Linux command-line interface (CLI) and run Linux commands and applications.

check which version you have
update if required
Screenshot of how the WSL icon looks on my explorer: our fav little penguin
set up your ubuntu acc

Purpose of WSL

The purpose of downloading Linux into Windows using WSL is to provide developers and data scientists with the ability to work with a Linux environment without the need for dual-booting or running a virtual machine. It allows you to leverage the power of Linux tools and utilities while still having access to your Windows applications and files.

Virtual machine vs WSL

The choice between using a virtual machine or WSL depends on your specific requirements and use cases. Here are some scenarios where each option might be more appropriate:

Advantages of Virtual machine:

  1. Full-featured linux. You can run any Linux software in a VM, and you have access to all the same features as you would if you were running Linux natively.
  2. More isolated. A VM is a separate operating system from Windows, so it’s more isolated from your Windows installation. This can be a good security feature, and it can also help to prevent problems if you have incompatible software installed on your Windows machine.

Advantages of WSL:

  1. Seamless integration with Windows: WSL provides better integration with the Windows environment. If you want to work with Linux tools while still having access to Windows files, applications, and services, WSL is a more streamlined option.
  2. Faster Startup time: WSL offers faster startup times, improved file system performance, and reduced resource overhead compared to running a full virtual machine.
  3. Lightweight development and productivity: If you are primarily a developer or data scientist and want a lightweight and efficient workflow, WSL allows you to work with Linux command-line tools directly from your Windows terminal, reducing context switching and improving productivity.
  4. Compatibility with Windows ecosystem: WSL allows you to run Windows executables and applications alongside the Linux environment, making it easier to use tools that have Windows-specific dependencies or graphical interfaces.

If you need to run a wide variety of Linux software and you want the most full-featured experience, then a VM may be a better choice. However, if you’re looking for a more integrated experience and you want to save on system resources, then WSL may be a better option.

Just need a terminal?

If you simply need a bash/Linux-style command prompt and don’t require the full Linux environment or features provided by WSL or a virtual machine, you can consider using Git Bash or Windows Terminal from the Microsoft Store. These options offer a lightweight command-line interface that supports Linux commands and provides a familiar Unix-like environment on Windows. Remember to change it to your default terminal for convinience!

Tip for data science!

In case you saved a model as a pkl in linux but need to open it in windows, use this to redirect PosixPath to WindowsPath.

import pathlib
temp = pathlib.PosixPath
pathlib.PosixPath = pathlib.WindowsPath
learn = load_learner('model.pkl')

--

--