--- title: "WSL" type: concept tags: [] last_updated: 2026-04-18 --- ## Summary - Windows Subsystem for Linux(Windows Linux 子系统),Microsoft 开发的在 Windows 上运行 Linux 发行版的兼容层 - 允许开发者直接在 Windows 上使用 Linux 工具、实用程序和 Bash,无需传统虚拟机或双系统启动 ## Key Features - 与 Windows 无缝集成,文件系统共享 - 支持多个 Linux 发行版(Ubuntu、Debian、SUSE、Kali 等) - 可通过 Windows Terminal 管理 - 直接调用 Windows 程序 ## Versions - WSL 1:一代架构,Linux 系统调用转换为 Windows API - WSL 2:二代架构,使用轻量级虚拟机,运行完整 Linux 内核,性能更优 ## Installation - Windows 10 2004+ 或 Windows 11:使用 `wsl --install` 一键安装 - 老版本:手动安装,需启用"适用于 Linux 的 Windows 子系统"可选组件 ## Commands - `wsl --install`:一键安装(默认 Ubuntu) - `wsl -l -v`:列出已安装发行版 - `wsl --set-version <1|2>`:设置版本 - `wsl -d `:启动指定发行版 ## Connections - [[Ubuntu]] ← default_distro ← [[WSL]] - [[WSL2]] ← extends ← [[WSL]] - [[Windows Terminal]] ← manages ← [[WSL]] - [[PowerShell]] ← invokes ← [[WSL]] ## Wiki Connections - [[Install WSL]] → describes → [[WSL]] - [[WSL2 启动与网络配置指南]] → describes → [[WSL2]]