-
list
wsl -l
或wsl --list
列出所有已安装虚拟机wsl -l -v
显示详细信息(也不怎么详细)wsl -l -o
列出网上可用的系统
-
terminate
wsl -t ubuntu
关闭ubuntuwsl --shutdown
关闭所有系统及虚拟机引擎
-
run
wsl -d ubuntu
启动ubuntu并进行终端wsl -u root
以root身份支行<distro>.exe config --default-user <username>
设置默认用户名
例如ubuntu.exe config --default-user root
-
install
wsl --install
安装默认虚拟机(ubuntu)wsl -l -o
列出网上可用的系统
-
执行命令
wsl <命令>
-
默认虚拟机
wsl
启动默认虚拟机并进入终端
wsl -s 虚拟机名
进入默认虚拟机 -
终端颜色
将默认用户改成root后终端没了颜色。
echo "source ~/.bashrc" >> ~/.bash_profile
vim /root/.bashrc
,将39行的force_color_prompt=yes
取消注释 -
网络连接
Accessing network applications with WSL | Microsoft Docs
虚拟机IP:ip a | grep eth0
物理机IP:cat /etc/resolv.conf
,在nameserver
后的是IP -
GUI
-
卸载虚拟机
wsl --unregister <DistributionName>
-
修改虚拟机名称
WSL 命令简单总结
于 2022-07-10 12:20:55 首次发布