Background
Obviously, my working OS is MS Windows.
But, I have very brief moments with Linux.
Once every couple of moments or so.
Managing Distributions in Windows Subsystem for Linux
Outline
Management-wise, here are some of what we can do with WSL:-
- Export and Import
- Export the distribution to a tar file
- Import specified tar file as a new distribution
- List Distributions
- List all distributions
- List running distributions
- Set default distribution
- Target Specific distribution
- Status Inquiry
- Terminate a running distribution
- Unregister a distribution and delete the root file system
Objective
In this post, we will target a specific distribution.
Tasks
List Distributions
List all distributions
Syntax
wsl --list
Sample
wsl --list -all
Output
Output – Image
Output – Textual
>wsl --list --all Windows Subsystem for Linux Distributions: CentOS8-stream (Default) Ubuntu
Explanation
- We have two Linux distributions installed:-
- CentOS8-Stream
- Ubuntu
- Default Distribution
- The default distribution is CentOS8-Stream
Target Specific Distribution
If we want to target a different distribution other than our default.
For us our default is CentOS8-Stream.
If we are to want to work on Ubuntu, we will invoke wsl and pass along Ubuntu as our distribution.
Syntax
wsl --distribution [distribution]
Sample
Let us request Ubuntu.
wsl --distribution ubuntu
Output
Output – Image
Output – Textual
>wsl --distribution ubuntu dadeniji@lab:/mnt/c$
Explanation
OS Version Inquiry
Please check the OS Version.
File – /etc/lsb-release
Let us read the contents of the /etc/lsb-release file.
Syntax
cat /etc/lsb-release
Sample
cat /etc/lsb-release
Output
Output – Image
Output – Textual
>cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04 LTS" >
Explanation
- Distribution ID:- Ubuntu
- Distribution Release:- 20.04
- Distribution Codename:- Focal
- Distribution Description:- Ubuntu 20.04 LTS
References
- Microsoft
- WSL
- Basic Commands
Link
- Basic Commands
- WSL