删除ubuntu中的WSL

4 阅读1分钟

*使用wsl下载了ubuntu,在ubuntu里又下载了wsl,我需要删除ubuntu中的wsl,应该怎么操作: *

一、先确认:你在 Ubuntu 里装的是啥

Ubuntu(WSL 里的那个) 里执行:

bash

运行

which wsl
wsl --version
  • 如果有输出,说明确实在 Ubuntu 里装了 wsl 工具;
  • 一般是通过 apt 装的,名字通常是:wslwindows-subsystem-for-linux

二、在 Ubuntu 里卸载它(关键步骤)

进入你的 WSL Ubuntu,运行:

bash

运行

# 1. 先查包名
dpkg -l | grep wsl

# 2. 卸载(常见包名)
sudo apt remove -y wsl
# 或
sudo apt remove -y windows-subsystem-for-linux

# 3. 彻底删除配置
sudo apt autoremove -y
sudo apt clean

执行完再检查:

bash

运行

which wsl   # 应该提示 not found

三、不要在 Windows 里乱执行这些(会删外层 Ubuntu)

❌ 千万别在 PowerShell 里运行:

powershell

wsl --unregister Ubuntu

这会把整个 Ubuntu 子系统删掉,不是你要的。