1. Talderon's Avatar
    [TL;DR] Linux in Windows - Not for everyone, but really cool for Dev's, Engineers, Hobbyists and those that want to learn.

    Hey all. I thought I would start a thread on the new BASH shell integration in Windows 10 Insider Preview.

    We can get into debates on the validity of this move and the pro's and con's, but I would like that to be in a different thread.

    The purpose of this thread is to get people started, teach them how to set it up and also some tips and tricks.

    One of the things I have learned by playing with this is it is near having Ubuntu running in tandem with Windows. It has it's own separate sub-system so it is really Linux in look, feel and usage. You have to configure it just like you would with an Ubuntu CLI installation. If you want to use JAVA, the installation of the JRE and JDK is separate from your Windows system. This gives you a LOT of room to do things in a true Linux Bash Shell without having to work around Windows.

    Is this for everyone? No. Will most consumers really get the warm-fuzzies from this feature? No. But for someone like me (Sr. DevOps Cloud Platform Engineer) and manages thousands of machines in AWS that are 100% Linux, yeah, I get all giggly when i can open a true bash shell and use my scripts and work in the cloud.

    The Linux Subsystem for Windows allows you to run Linux applications directly on Windows. Microsoft has worked with Canonical to offer a full Ubuntu-based Bash shell that runs atop this subsystem. Technically, this isnt Linux at all. Linux is the underlying operating system kernel, and that isnt available here. Instead, this allows you to run the Bash shell and the exact same binaries youd normally run on Ubuntu Linux.

    There are some limitations here. This wont work with server software, and it wont work with graphical software. Its intended for developers who want to run Linux command-line utilities on Windows. These applications get access to the Windows file system, but you cant use Bash commands to automate normal Windows programs, or launch Bash commands from the standard Windows command-line. They get access to the same Windows file system, but thats it. Not every command-line application will work, either, as this feature is still in BETA.

    Ok, let's get started.

    How do you activate/install these components.

    1. You MUST be running Windows Insider Preview Build 14316 or higher.
    2. You MUST be running 64 bit Windows 10


    As of this post, the build I am running is 14352, so if the instructions differ slightly to what you are seeing, poke around, you're bound to find it!

    • Open the Settings app and head to Update & Security > For Developers
    • Activate the Developer Mode switch here to enable Developer Mode.
    • Open the Control Panel, click Programs (you can type: appwiz.cpl into the search bar and open it that way)
    • Click Turn Windows Features On or Off under Programs and Features
    • Enable the Windows Subsystem for Linux (Beta) option in the list
    • --After you do, youll be prompted to reboot your computer. Click Restart Now to reboot your computer and Windows 10 will install the new feature.
    • Open PowerShell
    • Type: bash


    This will perform the actual installation of the Linux Subsystem
    You will be asked for a Unix User Name and Password, be sure to use something you will remember!! This does not have to be the same as your Windows login, but it can be. Just be sure to remember it.
    Once the installation is complete, you may be prompted to reboot your computer again

    Locate the "Bash on Ubuntu on Windows" link in your start menu and you will be dropped into your bash shell!

    Ok, here are some tips to get things going:

    Update your subsystem:

    Type: sudo apt-get update
    When you are asked for your password, this would be the password you set up during the installation of the subsystem. During the beta period, I would run this weekly to ensure you have the latest and greatest.

    If you ever try and run a command and are given a permission denied, just add sudo in front of it and enter your password. Your password will be cached for a short period of time so you will not have to enter it every time unless there are several minutes between sudo commands.

    Searching the Repo for Applications:

    Search for Available Packages: apt-cache search word (Replace word with a word you want to search package names and descriptions for.)

    Example: apt-cache search maildrop
    courier-maildrop - Courier mail server - mail delivery agent
    getmail4 - mail retriever with support for POP3, IMAP4 and SDPS
    maildrop - mail delivery agent with filtering abilities
    php-horde-ingo - An email filter rules manager
    rdeliver - A fully functioning mail filter with RubyFilter
    sensible-mda - Mail Delivery Agent wrapper
    spamprobe - Bayesian spam filter


    Once you see the package you want to install, use the apt-get command.
    When installing applications, you will need to use elevated permissions (sudo)

    Example: sudo apt-get install maildrop

    This will install the package and all dependencies.

    Uninstalling an application is just as easy.

    Example: sudo apt-get remove maildrop

    This will uninstall the package and all dependencies.

    A Few Environmental Catches

    Most of what I run in the cloud is CentOS or RHEL. It is a different Linux Distribution Subsystem than Ubuntu (Cent/RH is Fedora based and Ubuntu is Debian based) so the differences are several, but not altogether hard to get used too.

    I love using Alias'. for me using 'ls' is annoying and typing 'ls-la' is a pain, so normally I would put m y Alias' in my .bash_profile in my home directory. With this Ubuntu Subsystem, you have to put them in the '.bash_aliases' file. If it does not exist, create it.

    vi .bash_aliases

    This will open VI and the .bash_aliases (create when saved)

    The alias format is (one per line):

    alias <command_alias>="<shell_command>"

    Example: alias ls="ls -la"

    You will have to reload your environment config again: source ~/.bash_aliases
    (I created an alias for this as well: alias pload="source ~/.bash_aliases")

    Now, whenever you type 'ls' you will actually be running 'ls -la'

    Okay, I hope this will get things rolling and get people into this Bash on Windows!!!
    06-02-2016 11:33 PM
  2. Talderon's Avatar
    Oh yeah, I forgot to mention in this thread that you can access all of your drives from the Bash Shell.

    All of your drives are mounted in '/mnt/'

    Example:

    talderon@DESKTOP-I0T18NT:~$ cd /mnt
    talderon@DESKTOP-I0T18NT:/mnt$ ls
    Code:
    total 56
    drwxr-xr-x 2 root root 0 Dec 31  1969 .
    drwxrwxr-x 2 root root 0 Dec 31  1969 ..
    drwxrwxrwx 2 root root 0 May 31 19:44 c
    drwxrwxrwx 2 root root 0 May 31 19:44 d
    drwxrwxrwx 2 root root 0 May 31 19:44 e
    drwxrwxrwx 2 root root 0 May 31 19:44 f
    drwxrwxrwx 2 root root 0 May 31 19:44 g
    drwxrwxrwx 2 root root 0 May 31 19:44 h
    drwxrwxrwx 2 root root 0 May 29 15:24 i
    drwxrwxrwx 2 root root 0 May 31 19:44 j
    dchristilaw@DESKTOP-I0T18NT:/mnt$ cd d
    dchristilaw@DESKTOP-I0T18NT:/mnt/d$ ls
    Code:
    total 96
    drwxrwxrwx 2 root root 0 May 31 19:44 .
    drwxr-xr-x 2 root root 0 Dec 31  1969 ..
    drwxrwxrwx 2 root root 0 May 31 19:43 31e0ddb67f2b3b7e532f
    drwxrwxrwx 2 root root 0 May 29 23:22 talderon
    dr-xr-xr-x 2 root root 0 Jun  2 00:47 MapData
    drwxrwxrwx 2 root root 0 May 30 01:06 msdownld.tmp
    drwxrwxrwx 2 root root 0 Jun  2 20:11 Program Files (x86)
    drwxrwxrwx 2 root root 0 May 29 14:08 $RECYCLE.BIN
    drwxrwxrwx 2 root root 0 May 30 00:02 Rotation-05-29-16
    dr-xr-xr-x 2 root root 0 May 29 23:49 SoftwareDistribution
    d--------- 2 root root 0 May 29 23:21 System Volume Information
    drwxrwxrwx 2 root root 0 May 29 23:21 WindowsApps
    drwxrwxrwx 2 root root 0 May 29 23:34 WpSystem
    06-02-2016 11:38 PM
  3. nivesh d's Avatar
    Is there anyway one can open applications through this bash. I tried to open gedit and gnuplot application windows through this and it didnt work!!
    07-05-2016 06:42 AM
  4. Guzzler3's Avatar
    Can you access ext* formatted drives, yet?
    07-05-2016 09:07 AM
  5. harihar akhil's Avatar
    With bash for windows can I have ssh
    07-05-2016 09:42 AM
  6. wrecklass's Avatar
    With bash for windows can I have ssh
    Well, that's a tricky question. First of all, the Windows subsystem for Linux does have the ssh client so you can ssh to remote systems. However, if you are talking about logging into Windows 10 with ssh, that is a different matter. With the Anniversary update they have added an SSHD server, but when you log into your Windows 10 machine via ssh you are not in a Bash shell. Instead you are in the Powershell. I don't think you can start bash over the remote login.

    So yes, you can log in to Windows 10 with ssh, but it is not part of the Bash on Windows package. To use sshd from linux shell, you would have to disable the SSH remote proxy services and then install and configure SSHD under Linux. I have not tried this, so I can't say if that works. I just use CYGWIN with SSHD for now to accomplish this with more features than the Windows subsystem for Linux currently has.
    RumoredNow likes this.
    08-04-2016 02:33 PM
  7. wrecklass's Avatar
    Is there anyway one can open applications through this bash. I tried to open gedit and gnuplot application windows through this and it didnt work!!
    No, this does not work as the Windows subsystem for Linux does not recognize Windows apps and apparently there is no communications between Windows and Linux at this level. I believe there are people working on a work around for this, but for now this is one area where Cygwin provides more functionality than Windows subsystem for Linux.
    08-04-2016 02:50 PM
  8. nontheistzero's Avatar
    This is pretty cool. Another sandbox to play in!
    08-09-2016 06:33 PM
  9. Javier Alejandro Velasco Zapata's Avatar
    I have a problem using taskset on the bash, it doesn't work and executes the command on the four cores even though I'm using taskset 0x01 (which should force the command to execute on only one core).
    09-04-2016 06:56 PM
  10. zJEROMENATOR25's Avatar
    Has anyone tried installing a linux desktop environment on WIndows using Bash on Windows?
    11-27-2016 03:53 PM

Similar Threads

  1. Windows 10 reactivation after hardware change
    By Windows Central Question in forum Ask a Question
    Replies: 1
    Last Post: 07-05-2016, 11:51 AM
  2. Pure Hold'em bets on new tournament modes and more in latest update
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 07-05-2016, 11:00 AM
  3. Clear All doesn't clear Live Tile or Lock Screen
    By Windows Central Question in forum Ask a Question
    Replies: 1
    Last Post: 07-05-2016, 10:04 AM
  4. Snapchat for windows phone 10
    By Windows Central Question in forum Ask a Question
    Replies: 1
    Last Post: 07-05-2016, 09:35 AM
  5. Sega acquires PC and Xbox One game developer Amplitude Studios
    By WindowsCentral.com in forum Windows Central News Discussion
    Replies: 0
    Last Post: 07-05-2016, 09:00 AM
LINK TO POST COPIED TO CLIPBOARD