Skip to main content

Linux Bash Shell on Windows 10

Let's enable Ubuntu on Bash on Windows 10 Anniversary Update and later.

Windows 10: Enable 'Windows Subsystems for Linux' feature
Windows 10: Enable 'Windows Subsystems for Linux' feature



What happens if Developer mode is not enabled





Turn on developer mode





Run C:\Windows\Systems32\bash.exe


Check Ubuntu version

lsb_release -a


Update Ubuntu

sudo apt-get update



Ubuntu upgrade

sudo apt-get upgrade




Check Ubuntu version after upgrading



Notes from the fields

Ubuntu package's location in user's profile

By default, it is in:

%userprofile%\AppData\Local\Packages

In powershell, run this command to find out: Get-AppxPackage *Ubuntu*

PS C:\WINDOWS\system32> Get-AppxPackage *Ubuntu*
Name              : CanonicalGroupLimited.Ubuntu18.04onWindows
Publisher         : CN=23596F84-C3EA-4CD8-A7DF-550DCE37BCD0
Architecture      : X64
ResourceId        :                                                                                            
Version           : 2020.1804.7.0
PackageFullName   : CanonicalGroupLimited.Ubuntu18.04onWindows_2020.1804.7.0_x64__79rhkp1fndgsc
InstallLocation   : C:\Program Files\WindowsApps\CanonicalGroupLimited.Ubuntu18.04onWindows_2020.1804.7.0_x64__79rhkp1fndgsc                                                                             IsFramework       : False
PackageFamilyName : CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc
PublisherId       : 79rhkp1fndgsc
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok                                                                                                                                                                                                                                                                                                                                                                                                                                      PS C:\WINDOWS\system32> 

Move Ubuntu package to another drive

Refer to this question on superuser.com: https://superuser.com/questions/1443995/how-to-move-ubuntu-on-windows-to-drive-d-or-other-drive

C:\Users\Tuyen>wsl -l
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)

C:\Users\Tuyen>mkdir E:\wsl

C:\Users\Tuyen>wsl --export ubuntu-18.04 E:\wsl\ubuntu-18.04.tar.gz

C:\Users\Tuyen>dir E:\wsl\ubuntu-18.04.tar.gz
 Volume in drive E has no label.
 Volume Serial Number is 0285-3B90

 Directory of E:\wsl

03/27/2020  12:07 PM     9,084,385,280 ubuntu-18.04.tar.gz
               1 File(s)  9,084,385,280 bytes
               0 Dir(s)  158,935,080,960 bytes free

C:\Users\Tuyen>

Remove/Uninstall Ubuntu package

PS C:\WINDOWS\system32> Remove-AppxPackage -Package (Get-AppxPackage *Ubuntu*).PackageFullname
PS C:\WINDOWS\system32> (Get-AppxPackage *Ubuntu*).Name                                                        PS C:\WINDOWS\system32>              

Import Ubuntu package

C:\Users\Tuyen>wsl --import ubuntu-18.04 E:\wsl E:\wsl\ubuntu-18.04.tar.gz

C:\Users\Tuyen>wsl -l
Windows Subsystem for Linux Distributions:
ubuntu-18.04 (Default)

C:\Users\Tuyen>

Popular posts from this blog

MSSQL: Fix error 'Consistency validation for SQL Server registry keys'

While installing Microsof SQL Server 2012, I ran into the following error. "The SQL Server registry keys from a prior installation cannot be modified. To continue, see SQL Server Setup documentation about how to fix registry keys." How to fix Replace the D:\x64\FixSqlRegistryKey_x86.exe file with the original file from the ENU\SQLFULL_ENU.iso file downloading from Microsoft Download Center. This ISO file is 4.2GB. So you can click FixSqlRegistryKey_x86.exe to download this file only. After replacing that file, press Re-run to check. All rules are passed.

Powershell: Check Bad Logon

get-aduser -Filter {BadLogonCount -ne 0} -properties * | select SamAccountName,BadLogonCount,BadPasswordTime,BadPwdCount,@{name='badPasswordTimeDT'; expression={[datetime]::fromFileTime($_.badPasswordTime)}} | sort BadPasswordTime | FT

Powershell: Get-History

Get-History - Gets a list of the commands entered during the current session.