鉴于学生党大部分都是Windwos用户,怎么在Windows上搭载高效的前端开发环境,能影响到更多的人。
常用命令
查看已安装的子系统
wsl --list --verbose
导出已安装子系统镜像
wsl --export <Distro> <FileName>
wsl --export Ubuntu-20.04 E:\wsl\custom.tar
安装已导出的系统镜像
这样安装的优势是能安装在非C盘, 对于C盘内存紧张的用户来说非常友好
wsl --import <Distro> <InstallLocation> <FileName>
wsl --import custom E:\wsl\ubuntu_custom E:\wsl\custom.tar
子系统对于的文件
设置wsl默认子系统
wsl --set-default custom
wsl 完整使用命令
Arguments for running Linux binaries:
If no command line is provided, wsl.exe launches the default shell.
--exec, -e <CommandLine>
Execute the specified command without using the default Linux shell.
--
Pass the remaining command line as is.
Options:
--distribution, -d <Distro>
Run the specified distribution.
--user, -u <UserName>
Run as the specified user.
Arguments for managing Windows Subsystem for Linux:
--export <Distro> <FileName>
Exports the distribution to a tar file.
The filename can be - for standard output.
--import <Distro> <InstallLocation> <FileName> [Options]
Imports the specified tar file as a new distribution.
The filename can be - for standard input.
Options:
--version <Version>
Specifies the version to use for the new distribution.
--list, -l [Options]
Lists distributions.
Options:
--all
List all distributions, including distributions that are currently
being installed or uninstalled.
--running
List only distributions that are currently running.
--quiet, -q
Only show distribution names.
--verbose, -v
Show detailed information about all distributions.
--set-default, -s <Distro>
Sets the distribution as the default.
--set-default-version <Version>
Changes the default install version for new distributions.
--set-version <Distro> <Version>
Changes the version of the specified distribution.
--shutdown
Immediately terminates all running distributions and the WSL 2 lightweight utility virtual machine.
--terminate, -t <Distro>
Terminates the specified distribution.
--unregister <Distro>
Unregisters the distribution.
--help
Display usage information.
网络问题
wsl2的一些网络问题
查看主机ip
ip route | grep default | awk '{print $3}'