Programming Practices

Windows Subsystem for Linux Review

Windows Subsystem for Linux Review

Today’s post is for people who use Windows as the main operating system but sometimes need use Linux. 

For a long time I had two operating systems installed. Unfortunately, due to time, I did not have enough disk space, so I decided to look for a better solution. I tested  Windows Subsystem for Linux (WSL) and I think it’s a great solution.

I will try to explain what is WSL, compare to Linux VM or even a Git Bash. 

What is WSL?

The Windows Subsystem for Linux, or WSL, is an optional feature of Windows 10 that lets run GNU/Linux environment and allows Linux programs to run natively on Windows.

The point of WSL is to guarantee a high degree of compatibility with the Linux system ABI kernel to allow programmers working in Windows to use many tools, programs that run natively in Linux without binary modifications.

The official Microsoft website: Windows Subsystem for Linux Documentation

Advantages of WSL

✔️  Allows native launch of LINUX programs and tools.

✔️  WSL requires fewer resources (CPU, memory, and storage) than a full virtual machine.

✔️  You can use Windows and at the same time use the Linux (e.g command line tools).

✔️  Supports multiple GNU/Linux distributions.

✔️  It’s free and very easy to install.

✔️  Has UNIX utilities such as grep, awk, etc. and other advantages of using Linux.

Disadvantages of WSL

❌  You can’t run ALL Linux apps in WSL. WSL is a tool aimed at enabling users who need them to run Bash and core Linux command-line tools on Windows.

❌  WSL is a fresh product and has bugs. If you need all the power and functions of a Linux system, it would be better to run the system on a virtual machine (VM). 

❌  Microsoft did not design or build WSL for production workloads.

❌ WSL allows you to run Linux distributions only in the latest versions of Windows 10 and Windows Server 2016.

❌  WSL does not aim to support GUI desktops or applications e.g. Gnome, KDE, etc.  (But you can install additional program that allows you to open applications… I will explain later how to install it ^^)

WSL is a great tool, but if you really want to take full advantage of Linux, install it as a second system.

Link to GitHub where people report problems to Microsoft / WSL    WSL – issues

WSL vs Git Bash

Both are entirely different things but I want to compare WLS to Git Bash because Git bash gives standard Linux programs. 

Git for Windows (Git Bash) uses the mingwT-w64 and msys2 project (GCC compiler on Windows systems) and is based on the POSIX conformance layer. (POSIX is no longer supported from Windows 8)

In both cases you can use basic Unix commands but in GIT for windows you will not be able to use other programs that only work on Linux or use the GCC compiler.

Install the WSL

A very good guide was prepared by Microsoft about the installation of WSL. How to instal WSL

Personally, I chose the Debian distribution and tested it. After the WSL has been installed, you will be able to open the “Linux” terminal. If you want to run the window applications from the console level, you have to download separate programs (the console can’t display GUI :)).

WSL with Xfce 4

Xfce is a graphical environment designed for UNIX operating systems.

How to install graphical Linux applications and run these under WSL:

  1. You have to have an X server like VcXsrv or Xming, on your Windows machine.
  2. Download and install Xming X Server for Windows. Xming
  3. Enter in the WLS console:
    • sudo apt-get update

    • sudo apt install xfce4

  4. Next, you will need to modify the .bashrc file. (I suggest to use vim or nano)
    • cd ~

    • nano .bashrc

  5. The second command from above will open .bashrc in nano and you can scroll to the end of the file and write:
    • export DISPLAY=:0.0

  6. Save the modified file by pressing CTRL+X and answering Y when asked if you want to save the file. Close and restart the console window.

  7. After installation, start the XLaunch program.

  8. Select display setting
  9. On the next screen, keep the default settings:
  10. On the Extra settings screen, check third option Disable access control:
  11. Press Finish.
  12. Now, in the Bash console window, write:

    • xfce4-session

  13. Finish  

From my experience, Xfce works reasonably well with WSL.

Recommended Literature

If you want to learn more about the Linux command-line applications, I would recommend reading The Linux Command Line by William E.Shotts Jr.

One thought on “Windows Subsystem for Linux Review

Leave a Reply

Your email address will not be published. Required fields are marked *