How do I change the language of the Linux subsystem in Windows 10 (WSL)?
The Windows Subsystem for Linux (WSL) installation should automatically set the Ubuntu locale to match the locale of your Windows install. You can change the Ubuntu locale manually using the shell.
Run this command in bash.exe to change the language to US English:
sudo update-locale LANG=en_US.UTF8
If you get a
sudo: unable to resolve host
error whenever you runsudo
,Verify that you have a hostname set (with the
hostname
command).- If it isn't set, add it to the
/etc/hostname
file. - Ensure that
/etc/hostname
contains only the hostname.
Edit the file with
sudoedit /etc/hostname
(assuming you can get that to work); see this.- If it isn't set, add it to the
- Ensure that your
/etc/hosts
file contains entries for your actual hostname (spelled exactly the same) and/orlocalhost
. Again, usesudoedit
.
See Error message when I run sudo: unable to resolve host for more information.
- Relaunch the
bash.exe
for the changes to take effect. If that doesn't fix it, try restarting the service:
sc stop lxssmanager sc start lxssmanager
If you want to learn more about the bash in WSL, you can read the FAQ by Microsoft.
This manual describes different ways. Since in this case we are using Ubuntu, choose corresponding options. Summary:
- Change locale for current session only:
LANG=en_US.UTF-8
- Change locale permanently for current user: add
LANG=en_US.UTF-8
to~/.bashrc
- Change default system locale: use
LANG=en_US.UTF-8
in
/etc/default/locale
According to locale -a
the following English locales are available in my system by default: C
, C.UTF-8
, en_US.utf8
.