Home Beginner's Guide Unlock Linux commands on Windows 10/11 with WSL

Unlock Linux commands on Windows 10/11 with WSL

With the introduction of the Windows Subsystem for Linux (WSL), it's now possible to run a Linux distribution alongside your Windows installation, enabling you to use Linux commands without the need for dual booting or virtualization.

by Abraham
running linux commands on windows 10 11

Linux commands are powerful tools for managing and manipulating files and folders on Linux operating systems. They are essential tools for developers, system administrators, and tech enthusiasts. The popularity of Linux commands has grown over the years, and they are now being used on Windows 10/11 operating systems. This tutorial will illustrate how to run Linux commands on Windows 10/11. 

Linux commands on Windows 10/11 are gaining popularity because of the need to run Linux-specific applications on Windows. The Windows Subsystem for Linux (WSL) allows users to run Linux applications and utilities on Windows 10/11 without needing a virtual machine. This integration enables Windows users to access a vast number of Linux tools that were previously unavailable on Windows. This article provides different methods of running Linux commands on Windows 10/11 and explores the advantages and disadvantages of using Linux commands on Windows 10/11. 

What are Linux commands, and how are they used? 

Linux commands are terminal commands that perform specific tasks on a Linux operating system. They are entered into the command-line interface (CLI) to execute commands and interact with the system. Linux commands are essential for system administration, development, and general computer use. They can perform various functions, such as managing files and directories, configuring network settings, running system updates, and more. 

The Linux command-line interface can be accessed by opening a terminal window on a Linux operating system. In the terminal window, you can enter commands to execute them. The terminal window provides a text-based interface for users to interact with the system. Users can navigate through directories, create and edit files, and execute system commands using the terminal window. 

How important are Linux commands? 

Linux commands are essential for any user working with a Linux operating system. They provide a powerful toolset for managing and manipulating files and directories, configuring system settings, and running system commands. Developers and system administrators rely on Linux commands to manage and maintain their systems. The flexibility and power of Linux commands make them a crucial tool for any computer user. 

Running Linux commands on Windows 10/11 

To run Linux commands on Windows 10/11, you can use the Windows Subsystem for Linux (WSL) or a third-party terminal emulator. The WSL feature allows you to run Linux applications and utilities directly on Windows. It provides a complete Linux kernel and a full-fledged Linux environment, enabling you to run Linux commands like a Linux operating system. 

Method 1: Using the Windows Subsystem for Linux (WSL) 

To use the Windows Subsystem for Linux (WSL) on Windows 10/11, follow these steps: 

Step 1: Enable WSL (Windows Subsystem for Linux) feature 

To enable the WSL feature, follow these guidelines to the latter: 

Press the Windows key and search for “Turn Windows features on or off.”

turn windows features on or off

Turn windows features on or off

Scroll down and check the box next to “Windows Subsystem for Linux.”.

windows subsystem for linux

Windows Subsystem for Linux

Click the “OK” button to enable the feature.

click ok

Click Ok

Restart your computer.

Step 2: Install a Linux distribution from the Microsoft store 

Once enabled by the WSL feature, you can install a Linux distribution from the Microsoft Store. The Microsoft Store provides several Linux distributions, such as Ubuntu, Debian, and SUSE Linux Enterprise. 

To install a Linux distro from the Microsoft Store, follow these steps: 

Open the Microsoft Store.

open microsoft store

Open Microsoft Store

Search for the Linux distribution you want to install. (For illustration purposes, I searched for Ubuntu).

search for ubuntu

Search for Ubuntu

Click the “Get” button to download and install the distribution.

click the get button

Click the Get button

Wait for the installation process to complete.

Step 3: Open the Linux distribution and run Linux commands 

Once you have installed a Linux distribution, you can open it by searching for it in the Start menu. Opening the Linux distribution will launch a terminal window to enter Linux commands.

new terminal window

New terminal window

To run Linux commands on the Windows Subsystem for Linux (WSL), follow these steps: 

First, open the Linux distribution from the Start menu.

launch ubuntu

Launch Ubuntu

Once the terminal window appears, you can start entering Linux commands. But first, you must input your new Unix username and password. After that, you can run Linux commands on your Windows 10/11.

enter new unix username and password

Enter a new Unix username and password

To navigate directories, use the “cd” command followed by the directory name.

navigate to a directory

Navigate to a directory

To list the contents of a directory, use the “ls” command

list contents of a directory

List contents of a directory

To create a file, use the “touch” command followed by the file name

create a new file

Create a new file

To edit a file, use the “nano” or “vi” command followed by the file name. For example, I am going to edit the iLoveFoss.txt file. To do so, I will execute the following line of code:

sudo nano iLoveFoss.txt
edit ilovefoss.txt file

Edit iLoveFoss.txt file

To execute a system command, enter the command into the terminal window. For instance, to update the system, execute the following line of code:

sudo apt update
update system

Update system

Method 2: Using a third-party terminal emulator 

Alternatively, you can employ a third-party terminal emulator to run Linux commands on Windows 10/11. A terminal emulator is a utility application that provides a graphical interface for accessing an operating system’s command-line interface (CLI). Popular terminal emulators include PuTTY, Git Bash, and PowerShell. 

To use a third-party terminal emulator to run Linux commands on Windows 10/11, follow these steps: 

Step 1: Download and install a terminal emulator 

Download and install a third-party terminal emulator like PuTTY, Git Bash, or PowerShell.  For illustration purposes, I will use PowerShell, an inbuilt terminal emulator. This means you don’t need to worry about installing it on your Windows system.

Step 2: Launch the terminal emulator 

Launch the terminal emulator by double-clicking its icon.

launch powershell

Launch PowerShell

Step 3: Connect to the Linux system 

To connect to the Linux system, you must provide the IP address or hostname of the Linux system, along with your username and password.  For example, I will run the command below to connect to my other Ubuntu OS with the hostname rutto and IP 192.168.100.6.

ssh rutto@192.168.100.6
connect to the linux system

Connect to the Linux system

As you can see from the screenshot above, I have connected to the Linux system successfully.

Note: If you are prompted for a password, enter the password of the Ubuntu OS.

Step 4: Run Linux commands 

Once connected to the Linux system, you can enter Linux commands into the terminal emulator.  To test if the commands work, run these lines of code:

mkdir Foss

cd Foss/

touch iLoveFoss

ls
run this lines of code

Run these lines of code

As you can see, the commands work like a charm. I hope you enjoy running Linux commands on your Windows 10/11.

Advantages of running Linux Commands on Windows 10/11 

  • The main advantage of running Linux commands on Windows 10/11 is that it allows you to access many Linux tools previously unavailable on Windows. This integration enables Windows users to use Linux-specific applications and utilities on Windows. It also allows developers and system administrators to work with Linux and Windows systems without needing a virtual machine. 
  • Another advantage of using Linux commands on Windows 10/11 is that it provides a more robust toolset for managing and manipulating files and directories. The flexibility and power of Linux commands make them a crucial tool for any computer user, and by using Linux commands on Windows 10/11, you can take advantage of these tools. 

Disadvantages of running Linux commands on Windows 10/11 

  • One of the main disadvantages of running Linux commands on Windows 10/11 is that it requires additional setup and configuration. Users must enable the Windows Subsystem for Linux (WSL) feature or install a third-party terminal emulator to access Linux commands. This additional setup may confuse some users and require other technical knowledge. 
  • Another disadvantage of using Linux commands on Windows 10/11 is that they may not be as stable as using Linux commands on a Linux operating system. While the Windows Subsystem for Linux (WSL) provides a complete Linux environment, it is not the same as running Linux on dedicated hardware. Some Linux applications and utilities may not work correctly on Windows 10/11, and users may encounter compatibility issues. 

Things to keep in mind while using WSL on Windows

A point to consider is the potential impact on system performance when running Linux commands on Windows 10/11. Depending on the complexity of the executed commands, the system resources required to run them may be significant. This could lead to slower performance, especially if the Windows machine runs several applications. 

To mitigate this issue, users should ensure that their system has enough RAM and processing power to handle the Windows operating system and any Linux commands they intend to run. They should also consider optimizing their system settings to minimize unnecessary resource usage. 

Additionally, users should be aware that some Linux commands may not be compatible with Windows 10/11, especially those that rely on Linux-specific features or system configurations. In such cases, users may need to find alternative commands or use a dedicated Linux environment to achieve their goals. 

Finally, users should always exercise caution when using Linux commands on Windows 10/11, especially when dealing with sensitive files or system settings. It is recommended to have a backup of important data and to test any commands on non-critical files before using them on important data. 

Conclusion

Running Linux commands on Windows 10/11 can be a powerful tool for managing files and directories. Still, users should carefully consider their technical knowledge and system requirements before doing so. With proper planning and caution, users can take advantage of the best of both worlds, using the flexibility of Linux commands on the familiar Windows operating system. 

In this tutorial, we have explored the different methods that can be used to run Linux commands on Windows 10/11, including using the Windows Subsystem for Linux (WSL) and third-party terminal emulators. We have also discussed the advantages and disadvantages of using Linux commands on Windows 10/11. 

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.