Installing WSL
What is WSL​
The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.
You can:
- Choose your favorite GNU/Linux distributions from the Microsoft Store.
- Run common command-line tools such as
grep,sed,awk, or other ELF-64 binaries. - Run Bash scripts and GNU/Linux command-line applications including:
- Tools: vim, emacs, tmux
- Languages: NodeJS, JavaScript, Python, Ruby, C/C++, C# & F#, Rust, Go, etc.
- Services: SSHD, MySQL, Apache, lighttpd, MongoDB, PostgreSQL.
- Install additional software using your own GNU/Linux distribution package manager.
- Invoke Windows applications using a Unix-like command-line shell.
- Invoke GNU/Linux applications on Windows.
- Run GNU/Linux graphical applications integrated directly to your Windows desktop
- Use GPU acceleration for machine learning, data science scenarios and more
Installing WSL​
to install WSL on windows 11 open powershell as administrator and run this command
wsl --install
info
before running this command make sure you have at least 10 GB free space on drive C
info
by default wsl installs latests version on Ubuntu
try running wsl --list --online to see a list of available distros and run wsl --install -d <DistroName> to install a distro.
CLI Commands​
WSL 2 CLI Cheat-sheet To Be Run In Powershell
To list installed distributions​
wsl -l
# or
wsl --list
To list installed distributions along with its running status and wsl config being 1 or 2​
wsl -l --verbose
# or
wsl -l -v
To run a specific distro​
wsl -d distro_name
# or
wsl --distribution distro_name
To terminate/shutdown a specific distro​
wsl -t distro_name_to_shutdown
# or
wsl --terminate distro_name_to_shutdown
To shutdown all disstros​
wsl --shutdown
Set specific distro as default​
wsl -s my_default_distro
wsl --set-default my_default_distro
To EXPORT a running distro as image​
wsl --export distro_name_to_export windows_path\tar_file_name.tar
To IMPORT an image as distro​
wsl --import new_distro_name install_location_windows_path tar_file_name.tar --version wsl-version-1-or-2
wsl --import Ubuntu-20 D:\VMs\WSL\Ubuntu-20\ Ubuntu-20.04.tar --version 2 # Setting my secondary HDD as storate loc for new distro
To UNREGISTER (also removes the its file storage) a distro​
wsl --unregister distro_name_that_delete
danger
THIS OPERATION IS NOT REVERSIABLE
Online Documentation​
to see latest version of WSL documentation please visit here