Enable Bash on Windows 10

Enable Bash on Windows 10

Q. How do I enable Bash on Windows 10?
Dept - Windows 10

A. With build 14316 and above you can enable Bash in Windows 10 which provides the Bash shell running on a Ubuntu user-mode image via the new Windows Subsystem for Linux (WSL). This enables Linux tools to be utilized in a Windows environment. Note that you cannot access Windows applications from the Bash shell, essentially the Bash instance is running in an Ubuntu user-mode space so it cannot interact with Windows applications. Note that the Linux Ubuntu is not running in a VM, rather isolated in user-mode space without requiring a Linux kernel and actually running on the Windows kernel via the Windows Subsystem for Linux that intercepts the various system calls (syscall) from the user-mode Ubuntu and translates them accordingly for the Windows kernel.

To enable Bash perform the following:

  1. Select Start - Settings
  2. Search for Windows Features and in the results click Turn Windows features on or off
  3. Enable Windows Subsystem for Linux and click OK
  4. The installation will require a reboot
  5. Once the machine has rebooted open a command prompt and type bash to initiate the installation. This will take some time as the Ubuntu image must be downloaded from the Windows Store
  6. Once installed you will be in the bash environment. The local filesystems are available under /mnt, e.g. /mnt/c/ for c:\
  7. Type exit to leave bash

A shortcut "Bash on Ubuntu on Windows" will also be added to Start.

Some interesting commands:

  • lsb_release -a : View information about the Linux
  • ls /proc : Virtual filesystem that displays information about the system
  • cat /proc/cpuinfo - View information about the processor
  • ls /mnt/c - View C: drive of the Windows OS
  • Other commands like vi, gcc, apt-get etc will all work
  • Note that tab completion works in the environment
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish