DEV Community

Cover image for A LINUX IN MY WINDOWS OS.
Michael Ukachi
Michael Ukachi

Posted on

A LINUX IN MY WINDOWS OS.

Getting into programming as a beginner is no easy feat. While the Internet is a library of tons and tons of resources, sometimes you run into certain obstacles ( errors ) while practicing and also learn a ton of stuff. One of those obstacles would come from being unable to run certain commands in your terminal from a Windows OS.

Most online resources offer the solution to this problem, which is quite simple WSL. The window subsystem for Linux(WSL), is a whole new world in your Windows OS, giving you the same powers you would have on a Linux system. So how do we unlock this superpower on the Windows OS and what are the benefits, challenges, and practical use cases of the Windows subsystem for Linux

*But first, The benefits *

  1. Developers can access the power of both Windows and Linux at the same time on a Windows machine. Allowing for a complete environment. You will have heard the joke if you are serious about programming don't use a Windows

  2. The Windows Subsystem for Linux (WSL) lets developers install a Linux distribution (such as Ubuntu, OpenSUSE, Kali, Debian, Arch Linux, etc) and use Linux applications, utilities, and Bash command-line tools directly on Windows. more power

  3. You can perform all tasks like running docker and other heavy operations as you would on Linux without the overhead of a traditional virtual machine or dual boot setup right on the Windows OS.

*HOW DO WE ACTIVATE THIS SUPERPOWER *

One way for sure is by following the official Windows documentation so as not to run into any errors that might do some serious damage to your OS. link to documentation

You can follow along using the documentation for more info but today will be focused on how to get it up and running.

  1. In your Windows menu, open the PowerShell and click run as administrator once in type in the following command
wsl --install
Enter fullscreen mode Exit fullscreen mode

The command will enable all WSL features necessary to run WSL and also install the default Linux distribution Ubuntu.

  1. Once the installation is done, it will require you to create a profile for your new superpowered system, keep in mind that this does not remove the windows from the system instead, it creates a separate partition in your system for both Linux and windows showing how to properly install and activate the wsl distribution in Windows during installation

Once done as seen in the image, the successful installation message is prompted

several times when trying to use the WSL it will prompt for your username and password, what happens when that is forgotten? Luckily there is a fix, simply head to your PowerShell of course running as administrator, and run the following command.

wsl -u root
Enter fullscreen mode Exit fullscreen mode

You will be prompted to enter a new UNIX password and then confirm that password. Once you're told that the password has been updated successfully, close WSL inside of PowerShell using the command: exit.

  1. To make sure your new Linux system is up to date and always running properly considering that Windows does not automatically update or upgrade your Linux distribution, run the following command on your Ubuntu command line
sudo apt update && sudo apt upgrade
Enter fullscreen mode Exit fullscreen mode

SETTING UP THE WINDOWS TERMINAL AND OTHER REQUIREMENTS

Just like your command line interface on your Windows, let's set up something similar on our new playground to allow a friendly user interface while running and using the wsl system.

I mean who doesn't want to look like a badass software engineer once he opens up the terminal
what is possible while customizing the WSL Windows Subsystem for Linux in Windows

Following every step listed here would have you add Windows Subsystem for Linux to your arsenal of software weapons. Doing so would also mean learning to navigate around files and folders, using code editors, and mastering the Linux command lines and methods as well as methodologies. To learn more about that refer to the official documentation that shares tips and guides on setting up docker, vs code and the likes on your new wsllearn to set up docker, work with databases, and install vscode the Linux way

See you on the other side of the terminal.

Feel free to reach out to me through the following channels
LinkedIn : Michael ukachi
Twitter : @mike_ukachi

Top comments (0)