WSL子系统基本信息查看与操作

一、查看版本信息与参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
> wsl --version
Invalid command line option: --version
Copyright (c) Microsoft Corporation. All rights reserved.

Usage: wsl.exe [Argument] [Options...] [CommandLine]
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:
--cd <Directory>
Sets the specified directory as the current working directory.
If ~ is used the Linux users home path will be used. If the path begins
with a / character, it will be interpreted as an absolute Linux path.
Otherwise, the value must be an absolute Windows path.

--distribution, -d <Distro>
Run the specified distribution.

--user, -u <UserName>
Run as the specified user.

Arguments for managing Windows Subsystem for Linux:

--help
Display usage information.

--install [Options]
Install additional Windows Subsystem for Linux distributions.
For a list of valid distributions, use 'wsl --list --online'.

Options:
--distribution, -d [Argument]
Downloads and installs a distribution by name.

Arguments:
A valid distribution name (not case sensitive).

Examples:
wsl --install -d Ubuntu
wsl --install --distribution Debian

--set-default-version <Version>
Changes the default install version for new distributions.

--shutdown
Immediately terminates all running distributions and the WSL 2
lightweight utility virtual machine.

--status
Show the status of Windows Subsystem for Linux.

--update [Options]
If no options are specified, the WSL 2 kernel will be updated
to the latest version.

Options:
--rollback
Revert to the previous version of the WSL 2 kernel.

Arguments for managing distributions in 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.

--online, -o
Displays a list of available distributions for install with 'wsl --install'.

--set-default, -s <Distro>
Sets the distribution as the default.

--set-version <Distro> <Version>
Changes the version of the specified distribution.

--terminate, -t <Distro>
Terminates the specified distribution.

--unregister <Distro>
Unregisters the distribution and deletes the root filesystem.

二、查看已安装的WSL

1
2
3
> wsl -l
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)

三、查看运行中的WSL

1
2
3
> wsl -l --running
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)

四、停止运行WSL

1
> wsl --terminate

五、删除WSL

1
> wsl --unregister Ubuntu-18.04
  • 本文作者:括囊无誉
  • 本文链接: Linux/wsl-info/
  • 版权声明: 本博客所有文章均为原创作品,转载请注明出处!
------ 本文结束 ------
坚持原创文章分享,您的支持将鼓励我继续创作!