极简教程
1、从windows商店选择Linux发行版(如Ubuntu)
2、搜索栏输入 「功能」,勾选「使用于Linux的Windows子系统」,点击「确定」
3、重启电脑
4、先进入 Ubuntu
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: martin
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Sun Apr 25 01:40:59 CST 2021
System load: 0.52 Processes: 7
Usage of /home: unknown Users logged in: 0
Memory usage: 46% IPv4 address for eth1: 192.168.56.1
Swap usage: 0% IPv4 address for eth2: 10.15.38.103
1 update can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
This message is shown once a day. To disable it please create the
/home/martin/.hushlogin file.
5、后续可以在cmd.exe 或 powerShell中执行 bash.exe
进入 Ubuntu
C:UsersMartin>bash.exe
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
切记:小心执行mkdir -rf mnt
6、执行 cd mnt
就进入 Windows的文件系统
martin@LAPTOP:/mnt/c/Users/Martin$ cd /
martin@LAPTOP:/$ pwd
/
martin@LAPTOP-ANG1G62G:/$ ls
bin dev home lib lib64 media opt root sbin srv tmp var
boot etc init lib32 libx32 mnt proc run snap sys usr
martin@LAPTOP:/$ cd mnt
martin@LAPTOP:/mnt$
参考: