Install Linux shell on Windows 10: Difference between revisions

From XPUB & Lens-Based wiki
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Purpose ==
== 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 shell, or when you don't want to boot in Linux on a Windows/Linux dualboot to use a specific command line tool.
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 ==
== Details ==
Line 11: Line 13:
* Make sure you run the 64 bit version of Windows 10
* 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''.
* Enable the developer mode. Go to the Settings app > Update & Security > For developers > Use developer features, where you select ''developer mode''.
[[File:Developer mode.png|600px]]
* 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.
* 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.
[[File:Screenshot (5).png|600px]][[File:Screenshot (6).png|600px]]
* Reboot your PC. This might take a while.
* Reboot your PC. This might take a while.
* Open the Windows Store and search for Ubuntu. Install the app.
* Open the Windows Store and search for Ubuntu. Install the app.
[[File:Screenshot (1).png|600px]]
* Click on the Ubuntu button in the start menu, or use the command ''ubuntu'' in the command prompt (Windows 10 search for ''cmd'')
* 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.
* 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!
* You are ready to go! Use the command ''bash'' to get into the Linux shell in your command line app of choice.
 
[[File:Screenshot (8).png|600px]]


== Step by Step Recipe - Hyper Terminal ==
== 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 )
[[File:Screenshot (3).png|600px]]
* The .hyper.js configuration file opens. Find the ''shell'' line and change it to ''shell: 'C:\\Windows\\System32\\bash.exe',''.
[[File:Screenshot (4).png|600px]]
* Save and close the file.


== And then? ==
== And then? ==
Line 27: Line 50:


[[Category:Cookbook]]
[[Category:Cookbook]]
== Sources ==
* https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
* https://char.gd/blog/2017/how-to-set-up-the-perfect-modern-dev-environment-on-windows
* https://msdn.microsoft.com/en-us/commandline/wsl/about

Latest revision as of 23:19, 4 December 2017

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