Windows Subsystem for Linux
By Jean-Claude Colette Oct 16, 2018
We follow the evolution of the Windows subsystem for Linux and we present the new features of the system. We give some examples of Linux utilities calls from Windows.
In another article, we had already explained how to install the Windows Subsystem for Linux as well as Xming an X server for Windows. The WSL subsystem has since evolved as it now allows the installation of other Linux distributions than Ubuntu:
- openSUSE Leap 42
- SUSE Linux Enterprise
- Debian GNU / Linux
- Kali Linux
Our goal is not to compare all distributions here and we will stay true to Ubuntu to test some software.
We will talk again about the installation of a distribution that has changed slightly and we will explain how to call Linux programs from Windows. Finally, we will give concrete examples of using Linux software.
Installing the Windows Subsystem for Linux
To install the Windows Subsystem for Linux on Windows 10, we must search for Turn Windows features on or off by typing the phrase into the Start Menu. Scroll down then check off Windows Subsystem for Linux then click OK. Restart when the installation is complete.
We only must install Ubuntu from the Microsoft Store
Running a Linux program from Windows
In the latest builds of Windows 10, the bash.exe command has been deprecated and replaced by wsl.exe.
We can run a Linux tool by typing to the command shell:
The Linux command that follows wsl.exe runs in the WSL but considers the current shell directory as the working directory.
Thus, the following command will save the list of files and directories of the current directory in a file named lst.txt in this same directory.
wsl.exe ls > lst.txt
Examples of software use
First let's launch Ubuntu and in the bash shell, let's install some Linux software.
sudo apt-get install imagemagick
sudo apt-get install xfig
sudo apt-get install plotutils
sudo apt-get install gnuplot
sudo apt-get install pstoedit
Note that it is possible to install from a Windows shell by placing
wsl. exe in front of
Now open PowerShell, and let's create a directory LinuxWorks with the command:
and change the current folder to the new folder with:
We will start by using ImageMagick to create an image with the
wsl.exe convert -size 800x400 -fill blue label:'Hello' hello.png
Create a file containing the following text file:
.PS ellipse "Windows 10"; arrow; box "\fILinux" "\fP(Ubuntu)" arrow; ellipse "Windows 10" .PE
Convert the file to a GIF format
wsl.exe groff -p example.pic > example.ps
wsl.exe pstoedit -f fig example.ps example.fig
wsl.exe fig2dev -L gif example.fig example.gif
Here is the result: