Install Linux shell on Windows 10

From XPUB & Lens-Based wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Purpose

To install and then run a full bash shell in Windows 10. This makes you able to use most of the shell functionality in Windows, from running scripts to using package managers. This could be of use for people new to Linux, or when you want to use a specific terminal tool and don't want to boot in Linux on a Windows/Linux dual boot.

Next to that, there is a recipe to install an alternative to the default Windows command-line prompt: Hyper Terminal. This terminal is easier to use, and can be configured to open directly in the Linux shell.

Details

This solution is not a virtual machine, but makes use of the Linux subsystem which is part of Windows 10. Microsoft collaborated with Canonical on developing a distribution of the Ubuntu shell that runs on this subsystem. Technically this can't be called Linux, because the Linux kernel is replaced by the Linux subsystem in Windows. The only thing that is left are the GNU utilities and software. There are some limitations, of which the most important are that you can't use the shell for graphical software, server software, nor Windows software. You have however access to the Windows filesystem.

Step by Step Recipe - Ubuntu shell on Windows

  • Make sure you run the 64 bit version of Windows 10
  • Enable the developer mode. Go to the Settings app > Update & Security > For developers > Use developer features, where you select developer mode.

Developer mode.png

  • Go to the Windows 10 search and search for Turn Windows features on or off. Open the best match, scroll through the list and select Windows subsystem for Linux. Click Ok.

Screenshot (5).pngScreenshot (6).png

  • Reboot your PC. This might take a while.
  • Open the Windows Store and search for Ubuntu. Install the app.

Screenshot (1).png

  • Click on the Ubuntu button in the start menu, or use the command ubuntu in the command prompt (Windows 10 search for cmd)
  • Let the script run and go through the steps to make a user account. You can use any username or password, but it might be convenient to use the same user credentials as for your Windows installation.
  • You are ready to go! Use the command bash to get into the Linux shell in your command line app of choice.

Screenshot (8).png

Step by Step Recipe - Hyper Terminal

  • Download Hyper from https://hyper.is/
  • Install the application
  • After installing, open Hyper and go to the menu > Edit > Preferences (or use control + comma )

Screenshot (3).png

  • The .hyper.js configuration file opens. Find the shell line and change it to shell: 'C:\\Windows\\System32\\bash.exe',.

Screenshot (4).png

  • Save and close the file.

And then?

If all went well:

  • If you open the default windows command prompt, the command bash will let you enter the Ubuntu shell
  • If you open Hyper you will automatically enter the Ubuntu shell

Sources