Difference between revisions of "BashForWindows10"

From UMIACS
Jump to navigation Jump to search
m (nitpick: of -> for)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Microsoft has partnered with Canonical, the makers of [[Ubuntu]], to create the [[Windows]] Subsystem on Linux (WSL), which allows Windows 10 users to use Linux command line tools on Windows files through [[Bash]] such as <code>grep</code>, <code>sed</code>, <code>git</code>.  
+
Microsoft has partnered with Canonical, the makers of [[Ubuntu]], to create a release of the [[Windows]] Subsystem for Linux (WSL), which allows Windows users to use Linux command line tools such as such as <code>grep</code>, <code>sed</code>, <code>git</code> on Windows files through [[Bash]].  
  
 
==Prerequisites==
 
==Prerequisites==
 
+
In order to install Bash/WSL, you must be running a 64-bit version of either Windows 10 version 1607 or later or Windows Server 2019 or later. In Windows, open the Settings app > System > About to check if your Windows version is compatible.  
In order to install Bash/WSL, the Windows 10 OS must be a 64-bit version of Windows 10 Anniversary Update build 14393 or later. In Windows 10
 
, open the Settings app > System > About to check if the Windows 10 version is compatible. Bash/WSL '''cannot''' be installed on Windows 7 or Windows Servers, currently only Windows 10 is supported.  
 
  
 
==Installation==
 
==Installation==
 
 
<ol>
 
<ol>
<li> Turn on Developer Mode, Settings app > Update & Security > For Developers > Select the Developer radio button </li>
+
<li> First, turn on Developer Mode, open the Settings app > Update & security > For developers > Select the Developer radio button </li>
<li> Enable the Windows Subsystem for Linux, this can be done through turning on the feature through Windows Features or through an elevated Powershell session using:
+
<li> Enable the Windows Subsystem for Linux, this can be done by turning on the feature through the Windows Features program or through a PowerShell session
<code> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux </code>
+
* For the GUI method: Go to Control Panel > Programs and Features > Turn Windows features on or off (this will require local administrator privileges > Check the box for Windows Subsystem on Linux
 +
* For PowerShell method (in an elevated/administrator session) use the command: <code> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux </code>
 
</li>
 
</li>
<li> Restart the machine </li>
+
<li> Restart the system</li>
<li> Open a command prompt or Powershell session, and then run <code> bash </code>. Follow the remaining on screen instructions to finish setting up WSL. </li>
+
<li> Open a command prompt or PowerShell session, and then run <code>bash</code>. </li>
 +
<li> After accepting the license, the Ubuntu user mode image will be installed. </li>
 
</ol>
 
</ol>
  
 
==Use==
 
==Use==
 +
Simply run <code>bash</code> in a command prompt or PowerShell session to enter bash. The first time Bash is installed on Windows, a prompt will appear to create a Unix user. This Unix user account is completely separate from the Windows user account and has <code> sudo </code> permissions on the WSL. There is no GUI that is installed, nor can be installed.
  
Simply run <code> bash </code> in a command prompt or Powershell session to enter bash. There is no GUI that is installed, nor can be installed. Windows storage and files can then be accessed from <code>/mnt/...</code>, such as <code>/mnt/c/Users/myAccount</code>.
+
The Linux installation is located at <code>%localappdata%\lxss\</code>, which is a hidden system folder. {{Note| Do '''not''' use Windows tools to edit the files or sub-files within this directory as corruption of the Linux files could occur.}} Windows storage and files can then be accessed from <code>/mnt/...</code>, such as <code>/mnt/c/Users/myAccount</code>.
 
 
  
 
==External Links==
 
==External Links==
 
*[https://msdn.microsoft.com/en-us/commandline/wsl/about Bash On Ubuntu On Windows]
 
*[https://msdn.microsoft.com/en-us/commandline/wsl/about Bash On Ubuntu On Windows]
 
*[https://msdn.microsoft.com/en-us/commandline/wsl/install_guide Installation Guide]
 
*[https://msdn.microsoft.com/en-us/commandline/wsl/install_guide Installation Guide]
 +
*[https://msdn.microsoft.com/en-us/commandline/wsl/reference Command Reference]
 
*[https://msdn.microsoft.com/en-us/commandline/wsl/faq FAQ]
 
*[https://msdn.microsoft.com/en-us/commandline/wsl/faq FAQ]
 +
*[https://msdn.microsoft.com/en-us/commandline/wsl/user_support Linux User Account Explanation]

Latest revision as of 15:46, 13 January 2020

Microsoft has partnered with Canonical, the makers of Ubuntu, to create a release of the Windows Subsystem for Linux (WSL), which allows Windows users to use Linux command line tools such as such as grep, sed, git on Windows files through Bash.

Prerequisites

In order to install Bash/WSL, you must be running a 64-bit version of either Windows 10 version 1607 or later or Windows Server 2019 or later. In Windows, open the Settings app > System > About to check if your Windows version is compatible.

Installation

  1. First, turn on Developer Mode, open the Settings app > Update & security > For developers > Select the Developer radio button
  2. Enable the Windows Subsystem for Linux, this can be done by turning on the feature through the Windows Features program or through a PowerShell session
    • For the GUI method: Go to Control Panel > Programs and Features > Turn Windows features on or off (this will require local administrator privileges > Check the box for Windows Subsystem on Linux
    • For PowerShell method (in an elevated/administrator session) use the command: Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  3. Restart the system
  4. Open a command prompt or PowerShell session, and then run bash.
  5. After accepting the license, the Ubuntu user mode image will be installed.

Use

Simply run bash in a command prompt or PowerShell session to enter bash. The first time Bash is installed on Windows, a prompt will appear to create a Unix user. This Unix user account is completely separate from the Windows user account and has sudo permissions on the WSL. There is no GUI that is installed, nor can be installed.

The Linux installation is located at %localappdata%\lxss\, which is a hidden system folder.

Exclamation-point.png Do not use Windows tools to edit the files or sub-files within this directory as corruption of the Linux files could occur.

Windows storage and files can then be accessed from /mnt/..., such as /mnt/c/Users/myAccount.

External Links