Files
tldr/pages.zh/windows/wsl.md

36 lines
808 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# wsl
> 管理 Windows 子系统 Linux。
> 更多信息:<https://learn.microsoft.com/windows/wsl/reference>。
- 启动一个 Linux shell在默认发行版中
`wsl {{shell_command}}`
- 无需使用 shell 运行 Linux 命令:
`wsl --exec {{command}} {{command_arguments}}`
- 指定特定的发行版:
`wsl --distribution {{distribution}} {{shell_command}}`
- 列出可用的发行版:
`wsl --list`
- 将发行版导出为 `.tar` 文件:
`wsl --export {{distribution}} {{path\to\distro_file.tar}}`
-`.tar` 文件导入发行版:
`wsl --import {{distribution}} {{path\to\install_location}} {{path/to/distro_file.tar}}`
- 更改指定发行版使用的 wsl 版本:
`wsl --set-version {{distribution}} {{version}}`
- 关闭 Windows 子系统 Linux
`wsl --shutdown`