WSL (Windows Subsystem for Linux), provides access to Linux from your Windows 10 system without having to run a virtual machine or dual boot. In a previous post I walked through installing WSL. Now that we have WSL installed let’s take a look at getting it setup and launching some Linux distros.
WSL Color settings
The colors used for the WSL command prompt are hard to see and it’s even worse if you launch WSL from Powershell.
To change the colors for the command prompt run wsl and edit the .bashrc file.
nano ~/.bashrc
Uncomment the following line:
force_color_prompt=yes
About fourteen lines below that change this line:
PS1=’${debian_chroot:+($debian_chroot)}[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[00m]$ ‘
To this:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;37m\]\u@\h\[\033[00m\]:\[\033[01;37m\]\w\[\033[00m\]\$ '
After you save the file reload it so the changes take affect:
. ~/.bashrc
This changes the prompt color to white. (list of color codes)
WSL commands
List Linux distros installed on WSL
wslconfig /l
Change default distro
wslconfig /s SLES-15
(replace SLES-15 with the distro you want to make default)
You can also unregister an installed distro (This will destroy data associated with distro)
wslconfig /u SLES-15
You can launch specific distro by name
wsl -d SLES-15
replace SLES-15 with distro you want to launch
Update WSL Distro
Before you start installing packages it’s a good idea to update. (If you don’t you might get this error message)
E: Invalid operation update
Run the following commands to update (Ubuntu 18.04):
sudo apt update
sudo apt upgrade
WSL and Bash
Get a list of bash commands without having to go into your Linux distro
Run multiple screens within your WSL distro with tmux
(checkout this great tutorial for using tmux)
Run Windows executable apps from bash prompt
Hopefully these setup tips will help some folks get familiar with WSL.
If you see anything in this post that’s not correct or you have something I can add please let me know in the comments below.