- Thu 25 August 2022
- Linux
Intro:
- From time to time, we might need to run a Linux environment on windows to run Linux commands, we can do this by creating a virtual machine on the windows system however it would take more resources(CPU, Memory, and storage)
- But there is another option called WSL aka Windows Subsystem for Linux, which would require fewer resources than a full Virtual Machine.
- WSL also allows you to run Linux command-line tools and apps alongside your Windows command-line and you can even access your Windows files from within Linux environment.
How to install Linux system on Windows 10 using WSL:
-
Search for "Turn Windows features On or Off" in the windows search
-
It will open a window as below, scroll down, select 'Windows subsystems for Linux' and click on OK.
-
Once you click OK, it will apply the required changes and requests you to restart your system
-
After the restart, we can install our preferred Linux Distributions using "Microsoft Store" in your system, and search for 'Ubuntu' or 'Linux'.
-
Here, I am trying to install Ubuntu(Linux distribution)
-
Once installed, open the Ubuntu app, it will take a few moments to finish the installation and would launch a Ubuntu Terminal.
-
Inside the terminal, you will be asked to enter your Unix username and password, which is different from your windows credentials, so you can give new credentials here.
-
Finally, we can run Linux commands in the Ubuntu terminal
-
ls -al
, will list the files and directories in the current directory
How to navigate through Windows drives,
- enter the below commands
ls /mnt/
cd /mnt/c
ls -al
,cd Users/your_desktop_path/
Simple Linux Commands :
touch notes.txt
-- to create notes.txt text filenano notes.txt
-- opens the text file using default and simple terminal-based text editorcat notes.txt
--displays text in the filepwd
-- the path of the current working directory (folder)mkdir Music
-- creates a new 'Music' folder
You can find and learn more about the Linux command line here
Also, you can open the bash terminal in the windows cmd by running, bash
command-- and run Linux commands.