Let's BASH Windows 10! - new book on using BASH in Windows 10, with updated installation steps and scripts!
How to install the Ubuntu BASH shell in Win10
NOTE: more recent distributions of Windows 10 make this setup far easier. (ver 1703 seemed to install simply, YMMV)
Simply activating developer mode and typing "bash" in the "run" window might download it from the store, then add user and begin using.
In the latest release I was able to make this work by enabling developer mode, then going to windows programs and checking the box
for the Linux subsystem, then look for "bash.exe", if you don't find it after enabling developer mode and Linux, reboot. Then type
"bash.exe" and download from the store, answer questions, add a user (but it doesn't always work, sometimes it makes the home
directory, but doesn't add the user to /etc/passwd) and passwd. Then type exit, go to the start bar, find the orange Ubuntu Bash
icon and attach it to the task bar. Then click on the orange circle Ubuntu BASH icon, set colors and font. You'll be logged in
as root, look to see if the user account you created exists in both /etc/passwd and in /home. If not, type adduser .
Answer the questions, then type "su - " (where is the name you selected, in my examples it's "luser" for local
user. In the real world I will use one of the accounts I have in other Linux systems, or if primarily used with Windows, my Windows ID.
In some environments I use my Windows ID for my Linux accounts to make samba, ssh and file transfers less complex. YMMV of course.
Happy hacking, this tool isn't perfect, but it's the best UNIX-like tool for regular expressions in Microsoft to date! I find this
tool better than setting up Cygwin and doesn't require a network to use other Linux systems via Putty or X-windows. It's also much
better than XP's Services for UNIX. I've tested a variety of features in BASH on Win10 and the only area that's "sketchy" is networking.
BONUS FEATURE
So, use it locally and save files into the Windows directory path. Create a link to the "C" drive in your home directory and copy or
save files there so you can see them in Windows:
1) check to see if "C" is mounted, type: ls -al /mnt/C
2) if you see files listed, then type: mkdir /mnt/C/FILES-BASH ; ln -s /mnt/C/FILES-BASH FILES
3) in your home directory you'll see a link called "FILES". To test this type: touch FILES/testing.txt
4) open File Explorer in Win10, look at the C drive and look for the diretory FILES-BASH, and see if testing.txt is there. If so, :)
5) Any files you create or work on can be placed in that /mnt/c/FILES-BASH directory and are accessible from both BASH and Windows.
6) DO NOT USE SPACES IN FILE NAMES OR DIRECTORIES, trust me, it'll make your experience much less complex.
Need:
Win10 64 bit Anniversary Update (reached via version 1607 in update).
this version will NOT run BASH - you will need to update
IF NOT, then:
Open Settings.
Click on Update & security.
Click on Check for updates.
by going on line and updating you should get the current version that will allow BASH
Connect to the Windows Update servers, the update listed as Feature update to Windows 10, version 1607 - will download,
then hit Restart Now, and Win10 will finish the install. This should behave as a regular update for Win10.
To install BASH on Win10:
Open Settings.
Click on Update & security.
Click on For Developers.
Under "Use developer features", select the Developer mode option to setup the environment to install Bash.
unfortunately if you're in a corporate setting and under strict domain/security policies you may not be able to update
On the message box, click Yes to turn on developer mode.
once you select update the system will download and update, this may take some time
- After the components install, restart your computer. (It may select a later auto update, reboot now if possible)
- After the reboot, open Control Panel.
- Click on Programs.
- Click on Turn Windows features on or off.
Check the Windows Subsystem for Linux (beta) option and click OK.
After the components install, hit Restart now to finish.
After the restart, BASH will not appear in the "Recently added", it's not installed yet.
To complete the installation of BASH:
Open Start, search for bash.exe, and press Enter.
At the command prompt, type y and press Enter to download and install Bash from the Windows Store.
You'll need to create a UNIX account. This account doesn't have to be the same as your Windows account. Enter the username
and press Enter (you can't use the username "admin"). Select a username you have on other Linux systems or perhaps your
Windows ID. Using "luser" is fine, but if you SSH to another system you'll have to add the userid, so if you have one, use it.
Close the "bash.exe" command prompt.
Installation and setup are done, now you can use Bash from the Start menu.
This version of BASH is limited because of Windows, you'll need to verify that commands and scripts work as expected.
This is command line only without graphics support.
once you've created your user account you should configure your .bashrc
There are also limitations with SSH and Networking and will require local admin rights on the PC.
You will be able to access files on the drives, you will not be able to execute Windows applications at the prompt or via scripts.
This is a "beta" feature so prepare for it to be even more sketchy than normal Microsoft applications.
With the Win10 Anniversary update, Microsoft claims focus on core functionality to include:
Bash environment to run tools like awk, sed, and grep.
Basic features for languages, such as NodeJS / npm, Python, Perl, Git.
Command line editor, including vi, emacs, and ssh.
Linux user support.
Symlink support.
Ability to run apt and apt-get for updates and package testing.
Ability to mount local a local hard drive using /mnt
|