windows10 installation WSL use the Linux command in windows

0 Introduction

Now many people are accustomed to using windows system, whether it is work or play games or something, windows Linux is very easy compared to, Linux is more suitable for developers to use. For some reason I need to run linux commands, upload a virtual machine in windows is a solution, but installed virtual machine occupies your PC's performance, but also a lot of trouble, so thinking about how to run linux command in windows, there are two many connections systematic approach, but most of them are to be paid, to find a very lightweight application WSL in the Microsoft store, you can very well connected windows and Linux.

1 Installation WSL

1.1 enable optional features

  • Method One:
    Administrator, open PowerShell and run, and run:
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Method Two:
    Control Panel - View -> Categories - enable or disable the function windows or run appwiz.cpl - enable or disable the windows function, and then check the "windows subsystem applies to the linux" ,, Figure
    Here Insert Picture Description
    Need to restart the computer immediately after clicking, or fail to install WSL

1.2 Microsoft store selection system

In Microsoft Store in search WSL

select the appropriate version of Linux, generally:

  • Ubuntu 18.04
  • Ubuntu 18.04 ARM
  • Ubuntu 16.04
    after clicking to start the download, select install, can be installed successfully, you can start using it.

Use WSL 2

2.1

WSL found in the system application in the lower left corner, click to start using
the first run requires the user name and password. noteUser name can not be capitalized.
In addition you can also use wsl in cmd or bash starts.
In use, the need for cd /mntsystem into linux, in order to switch to another directory.
Linux command Daquan
then you can start to enjoy the use of a Linux command in windows.

2.2 wslconfig command management

  1. Set the default linux operating system
    wslconfig /setdefault <DistributionName>
    , as mentioned above, if you do wslconfig / setdefault ubuntu, then execute the command bash will run ubuntu
  2. Uninstall linux system
    wslconfig /unregister <DistributionName>
    when system problems arise, we can reinstall after uninstalling. Such as:
    wslconfig /unregeister ubuntu
  3. View linux system installed
    wslconfig /list
  4. Set the default login user
    When we run WSL, it will enter with the first run of the user login name, if you want to switch to another user, you can (with ubuntu for example):
    ubuntu config --default-user root
    In this way, later it will default to run ubuntu root landing.
Published 21 original articles · won praise 1 · views 1109

Guess you like

Origin blog.csdn.net/Elenstone/article/details/105285524