Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# install WSL (for question, answer [Y] to restart computer)
PS C:\Users\Administrator> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Do you want to restart the computer to complete this operation now?
[Y] Yes [N] No [?] Help (default is "Y"): Y
Path :
Online : True
RestartNeeded : True
# for example, download Ubuntu 18.04
PS C:\Users\Administrator> Invoke-WebRequest -Uri "https://aka.ms/wsl-ubuntu-1804" -OutFile "ubuntu-1804.zip"
PS C:\Users\Administrator> Expand-Archive ubuntu-1804.zip
PS C:\Users\Administrator> cd ubuntu-1804
PS C:\Users\Administrator\ubuntu-1804> .\ubuntu1804.exe
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: ubuntu # set default user account (any name you like)
Enter new UNIX password: # set default user password
Retype new UNIX password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
# for Windows resource, it is mounted on [/mnt/c], possible to access
ubuntu@RX-7:~$ df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 80G 16G 65G 20% /
none 80G 16G 65G 20% /dev
none 80G 16G 65G 20% /run
none 80G 16G 65G 20% /run/lock
none 80G 16G 65G 20% /run/shm
none 80G 16G 65G 20% /run/user
C: 80G 16G 65G 20% /mnt/c
ubuntu@RX-7:~$ ls -l /mnt/c
ls: cannot access '/mnt/c/pagefile.sys': Permission denied
total 0
drwxrwxrwx 1 ubuntu ubuntu 512 Sep 12 22:26 '$Recycle.Bin'
lrwxrwxrwx 1 ubuntu ubuntu 12 Feb 25 2019 'Documents and Settings' -> /mnt/c/Users
drwxrwxrwx 1 ubuntu ubuntu 512 Sep 15 2018 PerfLogs
drwxrwxrwx 1 ubuntu ubuntu 512 Feb 25 2019 'Program Files'
drwxrwxrwx 1 ubuntu ubuntu 512 Sep 15 2018 'Program Files (x86)'
drwxrwxrwx 1 ubuntu ubuntu 512 Apr 8 20:49 ProgramData
drwxrwxrwx 1 ubuntu ubuntu 512 Feb 25 2019 Recovery
d--x--x--x 1 ubuntu ubuntu 512 Feb 25 2019 'System Volume Information'
drwxrwxrwx 1 ubuntu ubuntu 512 Sep 12 22:26 Users
drwxrwxrwx 1 ubuntu ubuntu 512 Sep 13 2019 Windows
# to access Linux resource with root priviledge, use [$ sudo (command)] with a user you added on initial use
ubuntu@RX-7:~$ sudo ls -la /root
[sudo] password for ubuntu:
total 4
drwx------ 1 root root 512 Jul 25 2018 .
drwxr-xr-x 1 root root 512 Sep 12 22:49 ..
-rw-r--r-- 1 root root 3106 Apr 9 2018 .bashrc
-rw-r--r-- 1 root root 148 Aug 17 2015 .profile
|