How to Use Linux Terminal in Windows 10

We may receive a commission for purchases made through the links on our site. This helps us keep everything up and running.
How to Use Linux Terminal in Windows 10

It is now possible to access the majority of the Linux command-line utilities and programs in conjunction with Windows 10 OS using Windows Subsystem for Linux (WSL).

While Windows is among the popular and popular operating system for laptops and desktops however, it’s not as secure or open-sourced like Linux OS. This is the reason the reason why many professional and software developers prefer Linux OS.

Microsoft has announced an alliance with Canonical the creators of Ubuntu Linux. This has made it possible for Linux users to run Linux with Windows. Yes you can use Linux on the top of Windows 10 without the need to use a dual boot or by using VMWare/VirtualBox or using it as your primary Operating System.

It is possible to access a variety of Linux software and commands via the Linux terminal on Windows 10. In this post we’ll provide step-by-step steps on installing and use the Linux terminal on Windows 10 OS.

Enable Windows Subsystem for Linux (WSL) and Install Ubuntu in Windows 10

If you plan to use an Linux terminal with Windows 10, you must first enable the Windows Subsystem for Linux’ feature. After that, you can download and install the desired version from the Linux distribution.

Windows Subsystem for Linux (WSL) Windows Subsystem for Linux (WSL) is an option that provides an environment for GNU/Linux that allows users to run the essential Linux command-line utilities and services directly on Windows along with your desktop and the latest store applications.

When you enable Windows 10’s Linux subsystem, you are able to install and run a variety of Linux distributions (distros) like Ubuntu, OpenSuse, SUSE Linux, Fedora, etc.

First, Check your Windows Version

Before we go into the steps you can activate Windows Subsystem for Linux (WSL) and install Linux it is important to verify that you have an appropriate version of Windows 10. WSL is supported only by the two platforms: Windows 10 64-bit (from version 1607) and Windows Server 2019.

To verify the status of your Windows Version and Build, visit Settings from the Windows Start Menu.

Then, select “System” setting.

Scroll down, and click ‘About’ on the lower left-hand side to open the About section.

In the page titled About under Windows specs, you will find the ‘Version’ as well as OS build’ of the version of Windows 10.

Enable Windows Subsystem for Linux

There are two distinct kinds of WSL versions: WSL 1 and WSL 2. Both offer smooth as well as continuous integration with Linux inside Windows, WSL 2 is the most recent and fastest version that supports the all Linux kernel and compatibility with system calls. WSL 1 runs a translation layer that connects Linux kernel and Windows.

  • For you to run the WSL2 it is necessary to have Windows 10 x64 bit systems Version 1903 or greater and with Build 18362 or greater.
  • For running the WSL1 program You will require Windows 10 x64 bit systems with version 1709 or greater and Build 16215 or higher.

It doesn’t matter what version of WSL you’d like to run, you have to enable it in order to make use of it. To enable it, typing “Turn Windows features off and on in the Start Menu search field.

Choose ‘Turn Windows Features off and on’ from the control tab from your search results.

Scroll down to “Windows Subsystem to Linux’. then tick the box next to it, and then click the OK button.

After the changes have been applied After the changes have been applied, click ‘Restart Now to reboot your computer.

If you are only planning to download WSL 1, you can start your computer now to install the Linux distro.

Enable WSL 1 via PowerShell

You can also activate WSL by using the PowerShell command-line tool. It performs the same function like Windows Features. Windows Features control panel. To do this, launch ‘PowerShell as an administrator and then run the following command.

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

Enable WSL 2

We suggest that upgrading the version of your WSL up to the latest version to increase performance, and also to run a genuine Linux kernel right on Windows 10. All you have to do is turn on the Virtual Machine Platform feature, in addition to the Windows Subsystem for Linux feature in the Windows Features control panel (see below for more details).).

Allow the changes to be reflected, and then reboot your computer.

Enable WSL 2 via PowerShell

The first step in enabling WSL 2 is enabling the Virtual Machine Platform feature component on Windows. It is also possible to activate WSL 2 via the ‘PowerShell command-line tool. To enable it, you must start ‘PowerShell’ in the role of an administrator and then run the following command in addition to WSL 1. WSL 1 command.

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

Set WSL 2 as the Default Version

Before you set up WSL 2 as your default across all Linux distributions Download WSL 2 and install the WSL Linux kernel package update for x64 systems..

Start the .msi installer to install the installer. It takes only a few minutes.

To make WSL 2 as your default version when you install a new Linux distribution, you must open PowerShell and execute this command

wsl -set-default-version 2

Restart your system to change your feature to WSL 1 to WSL 2.

Install the Linux distribution of your choice

WSL is now enabled, we can install the Linux distribution. The first step is to search for Microsoft Store on the Start Menu search box. After that, you can open it using the search result.

There is the list of all Linux distribution currently available on the Windows Store which are supported by WSL.

  • Ubuntu 16.04 LTS
  • Ubuntu 18.04 LTS
  • Ubuntu 20.04 LTS
  • openSUSE Leap 15.1
  • SUSE Linux Enterprise Server 12 SP5
  • SUSE Linux Enterprise Server 15 SP1
  • Kali Linux
  • Debian GNU/Linux
  • Fedora Remix for WSL
  • Pengwin
  • Pengwin Enterprise
  • Alpine WSL

Each of these distributions is accessible for download at no cost. In our course we’ll choose Ubuntu.

On the Ubuntu distribution’s website, click the “Get” button.

In the near future, Ubuntu distribution will be installed automatically and downloaded to your PC.

After the installation is complete After that, press the ‘Launch’ button to start the terminal. It is also possible to start the application from the Start Menu in Windows.

A brand new Ubuntu terminal will be displayed. The initial launch will take just a few minutes to sign-in the Ubuntu environment using WSL. After that the terminal will ask users to set up a new Unix user name’ as well as a ‘new password’. Input the username, password and new one, and complete the configuration.

When the setup is completed, it will bring users to the command line of bash. It is recommended to upgrade the software immediately. In Ubuntu, you can look for updates, download and install updates to software using the appropriate command.

Use the following command to update your software. You’ll be asked for the password. Enter the new password to execute the command as an administrator.

sudo apt update

The ‘update’ command will bring up-to-date your Ubuntu repositories.

Ubuntu can download a set of list of packages.

However, they haven’t been yet upgraded. To upgrade all packages available use this command

sudo apt upgrade

Click Y when you are asked to proceed with the installation.

The command ‘dist-upgrade’ upgrades packages to the latest version.

Upgrade WSL1 to WSL 2 for Ubuntu

If you want to upgrade your existing WSL 1 version to WSL 2 for a particular distribution. Run the following command using PowerShell.

wsl -set-default-version  2

Replace the ‘Distro>’ argument by the name of the distribution (Ubuntu in our instance) the WSL 1 install runs.

You can now use Linux commands and applications on the Windows 10 system using this Ubuntu Environment.

Bash Shell bash shell Windows 10

Now you have a complete command-line shell called ‘bash’ that is based on Linux. Linux distribution. You are able to access all Linux commands and applications through the bash shell.

To launch bash shell, type “bash in the Start Menu search field and press the Enter key to launch the bash command-line tool.

You can now begin running commands from there.

Enjoy Linux on Windows!