How To Work Linux Commands In Windows

Are you a Windows user who is feeling adventurous and wants to dabble in Linux commands? Or are you a seasoned Linux user who has recently switched to Windows but misses the familiar command-line interface? Either way, you’re in the right place! This blog post will guide you on how to use Linux commands in your Windows system.

Introducing Windows Subsystem for Linux (WSL)

Microsoft has blessed us with the Windows Subsystem for Linux (WSL), which allows you to run Linux command-line tools directly on a Windows machine without the need for a full-fledged Linux operating system.

Installing WSL

Before we can dive into running Linux commands, we need to set up WSL on your Windows machine. Here’s how:

Step 1: Enable the Windows Subsystem for Linux

You can enable WSL through Powershell. Right-click on the start button and select “Windows PowerShell (Admin)”. Then type this command:

wsl --install

Step 2: Restart your machine

Once you run the command, your system will ask you to restart. Make sure you save any ongoing work and then proceed with the restart.

Step 3: Set up a new Linux distribution

After restarting, open Microsoft Store and search for your preferred Linux distribution (Ubuntu, Debian, etc.). Click on “Get” to install it. Once installed, open it, and it will guide you through setting up a new user account and password.

Running Linux commands

Now that we’ve set up WSL and have a Linux distribution installed, we can start having fun with Linux commands. Open your Linux distribution from the start menu, and it will launch a terminal window.

Let’s try the ls command, which lists the contents of the current directory:

ls

How about the pwd command, which prints the path of the current directory:

pwd

You can even try the echo command, which prints a line of text:

echo "Hello, World!"

And voila! You’re now able to run Linux commands directly on your Windows machine.

Conclusion

The Windows Subsystem for Linux provides an excellent bridge for those who want to explore the power of Linux commands without leaving the comfort of the Windows environment. So go ahead and experiment, explore, and most importantly, have fun!