
Fun with the Windows Subsystem for Linux - runesoerensen
https://blogs.windows.com/buildingapps/2016/07/22/fun-with-the-windows-subsystem-for-linux/
======
cannonpr
I grew up through some of the more interesting business practices Microsoft
employed, and it's several attempts to harm the Linux ecosystem. I would love
to see this move by Microsoft in a positive light, but can't help but be
suspicious ? For now the possibilities it opens are great, however I wish I
understood Microsoft's strategic view of this and how it might evolve over
time for Linux.

~~~
dump121
Strategic View is simple I believe, they want developers back in there fold.
MS sells Windows and most devs have no problem with its UI but want to use
linux CLI, also some new tools/languages are developed only/first for Linux.
Now OSX being compatible has captured this lucrative marketshare.

Having good developers using Windows will be a great boost for ecosystem, a
percentage may choose to experiment with UWP, a react-native developer may try
a Windows version of app.

Only thing to loose is people may not build cli tools for Windows, but that is
already a lost cause. Linux won't pose a threat to GUI, so no chance of non
developers getting comfortable and migrating to Linux. So win-win and later
some more win.

~~~
sbarre
This is exactly me. When I can start running Linux(-ish) command line tools in
Windows, I'll ditch my Macbook for a Dell in a hot second..

Here's a question though that I seem to not see answered (but maybe I'm not
reading enough):

Can I run MariaDB or nginx or other "servers" in this environment? Or does
that stuff not work?

~~~
MrFlynn
I don't see why you wouldn't be able to. Then again, some tools don't seem to
work for some inexplicable reason (ex screen).

~~~
nitrogen
I haven't tried W10 at all, but it's likely they didn't implement all of the
terminal features required by screen, or that they did, but $TERM is set to
something not recognized by [the terminal library that presumably underpins]
screen.

For any new programmers who want to learn more, search for "ANSI escape
codes", VT100, "terminal emulation", termcap, and terminfo. Maybe add curses
and pseudoterminal for extra credit.

------
petercooper
Appreciate this is a minor point but the name _Windows Subsystem for Linux_
confuses me. Am I missing how to read it properly? It seems more like a
_Linux_ subsystem _for Windows_ to me :-)

~~~
spb
It's a Subsystem _of_ Windows _for Linux_ execution.

------
lucb1e
Sounds like Windows users discovering (and apparently having "fun with")
GNU/Linux. None of this is really specific to this subsystem.

~~~
ryanlm
I agree. This looks like an elementary Linux tutorial.

~~~
vmarsy
Agreed. for an elementary tutorial, I would have not put that

    
    
      rm -rf /mnt/c/

command on it, at least I would have put a # in front just in case.

Once the authors discovers GNUScreen/tmux, xargs and other tools, his life
will change :)

~~~
rodgerd
tmux works, screen shits the bed.

~~~
WaxProlix
Is there a reason for this / is it likely to be fixed anytime soon? I grew up
with screen but this might be a good reason to try out tmux, I guess.

~~~
stuxnet79
I tried out tmux starting from a week ago after a long time using screen, and
after I changed the key-bindings to be more screen-like I have to say that I'm
very impressed. I wasn't even close to a screen power user but with tmux I
feel like I have screen plus a whole lot of extra.

------
mark-r
So the Windows 10 console _finally_ gets back the escape sequence capability
that DOS had with ANSI.SYS? About frickin' time!

------
asrt
That name bothers me. I understand that people don't want to use the name
GNU/Linux because it's stupid and overcomplicated, but in this case there is
no Linux at all. This is quite literally GNU running on top of the NT kernel,
so why use the Linux name at all?

On a side note, the irony of GNU/NT must be killing Stallman.

~~~
ajdlinux
Cygwin is GNU on top of the NT kernel. WSL is an implementation of a Linux
ABI. In theory, you could run a non-GNU userland environment compiled for
Linux on top of WSL.

------
sdegutis
ELI5: What does this mean to me, as a developer who's really familiar with
(and prefers) Linux, but has to use Windows? What cool possibilities will this
"Linux Subsystem For Windows" open up to me? What things will it specifically
_not_ open up to me?

~~~
SwellJoe
I've been primarily a Linux user since 1995, and have been using Windows
10+WSL for the past week or so, since getting a new laptop.

The only thing I can think of that it'll open up for you is if you want to
develop for Windows, while still having Linux available to you. Whether that's
for developing games (most of the good game development tools run only on
Windows, even if they can deploy to Linux/Mac/Android), or developing for
Windows Phone (or whatever it's called this week), using Microsoft technology
like Visual Studio and C# (though it's now possible to do most things on Linux
via .Net Core, I think), or playing games that aren't available for Linux.

The modern Linux desktop is every bit as good as Windows (and Mac OS), IMHO,
though I'd be willing to bet accessibility is still better on Windows.
Hardware compatibility for modern devices is probably still better for
Windows, too, though old devices certainly are more likely to run on Linux
than Windows (a lot of my pro audio and music equipment hasn't run under
Windows since like Windows Vista or something, but still works fine under
Linux).

From my perspective after a week of tinkering with it, and using is
exclusively for my development work, I don't feel like it has given me
anything over my Linux environment. But, it does make the Windows development
experience much closer to what I expect from Linux. If I developed Windows
desktop applications, I would tell a different story, but I develop
applications that run on Linux servers; developing on Windows provides no
benefits, only negatives...but the negatives have gotten so small that they
probably don't matter, anymore. A new developer just learning to build web
apps, for example, could do it pretty much as easily on Windows as they could
on Linux. Which has _never_ been as true as it is today.

WSL is still very buggy and quirky, and the Windows build it runs on crashes
several times a day (at least on my laptop, it does), so it's a net loss in
productivity for me, as I'm spending some time waiting on reboots. But, in a
few months, it'll probably be stable, widespread, well-documented, etc. And,
at that point, maybe it'll even be an ideal option for some developers who are
building for cross-platform deployment. Who knows, maybe in a few months, I'll
find myself wanting to build something for Windows. I might come back from
Linux for a while to spend time in Windows; I certainly don't hate it as much
as I used to.

~~~
MichaelGG
>The modern Linux desktop is every bit as good as Windows

Like resizing Windows in Xubuntu? They give you a 1 px border to grab. Bug
reported years ago. No fix; happens in all built-in themes. This kind of lack
of polish is everywhere.

It's good, it's functional, usable, I'd take it over Windows XP or something,
but let's not say it's every _bit_ as good.

~~~
nekitamo
Regarding resizing windows on Xubuntu: Hold alt then hold right click and
drag. It is very easy to resize this way.

------
ChuckMcM
I am really looking forward to this for my Surface Book. Historically I've
loaded up a virtual machine running Linux, this was more complete and had
fewer hiccups than a Cygwin type of setup for me. Of course it would be
_REALLY_ useful if they also support NFS for mounting stuff from my NAS
appliance and a compositor (Wayland/X11/Etc.) that would allow things that
create windows to work as well.

~~~
KirinDave
I use the current fast ring insider builds with no substantial problems right
now. Why wait?

~~~
rodgerd
It's on the slow ring now, too, which is where I'm using it. I'm quite
impressed so far. There's some performance overhead in some cases (e.g. Hugo
for Linux is about half the speed in the lxrun environment than Hugo for
Windows on the same machine), but it's very pleasant.

------
stevehiehn
I'm have high hopes for bash on windows. It has the 'potential' to keep me on
Windows a little longer. We shall see.

~~~
kevin_thibedeau
If all you need is Bash just install Msys. I use it every day to escape from
crusty cmd.exe.

------
Animats
Why would you need a Linux subsystem to run Python? Python runs just fine on
Windows. All my Python programs run on both platforms.

If you just want command line tools, there's Cygwin.

~~~
xabotage
My experience with WSL has been excellent so far, I see it making Cygwin
obsolete almost entirely. Cygwin was always a pain to set up and occasionally
very buggy.

~~~
spapas82
And slow. For some reason all commands I execute through cygwin seem to be
taking a little more than if executed through a normal windows command prompt.

This really breaks the cygwin experience for me :/

------
SwellJoe
I just got a new laptop, and as it doesn't have an optical drive and I
couldn't find a USB flash drive in order to install Linux, I've kinda been
stuck on Windows for a few days.

I installed WSL a few days ago. Installation is a _ridiculous_ process, and
takes about 24 hours for the service to finally appear after you follow the
steps to make it happen, which is not well-documented and just feels idiotic
to a Linux user, who's used to being able to change kernels in about three
minutes, and switch back and forth at will.

But, I mostly love it. I still plan to install Linux and I'm unlikely to ever
boot back into Windows except maybe for testing (I used to boot into Windows
for games, but these days Steam has more than enough Linux games to keep me
happy, as I don't game much), but Windows is suddenly not the worst of all
possible worlds for developing software for Linux, anymore.

It has some weird/scary quirks: Using an editor installed on the "Windows"
side of the system to edit files on the "Linux" side of the system led to
files disappearing completely. I also saw the usual Windows CR/LF issues in
sharing files between Linux and Windows partitions, but also an additional
weird thing that might be Unicode related: I piped output from a command into
a file on the Windows side in a Powershell session, opened it on the Linux
side, and found it had spaces after every character and some other bizarre
stuff inserted into it; kinda like maybe it was created in a UTF encoding but
then loaded in a non-Unicode encoding or something. These are probably things
that have some reasonable explanation and some way to work around them, but
they made me scared enough of inter-operation between the two sides that I now
isolate the two completely. I don't try to work "back and forth". If it's a
Linux thing, I work only with Linux tools, and vice versa. This doesn't seem
to be as big of an issue when using the MSYS bash shell that comes with git,
which is my other bash shell in this system. At least, using the git bash
shell hasn't led to any files disappearing.

Another interesting issue: Permissions are _super_ lax, by default, in the
Linux side. Owned by root:root and mode 777 across the board in your home
directory, which causes a lot of software to complain. ssh, Ruby bundler
(downgrade to 1.12.3 if you're having problems running bundle on Windows,
either under WSL or in Powershell; same solution works for different bugs),
and a bunch of other stuff has weird quirks when given a directory that is
777. It's also just plain nuts. I guess Windows has a different security model
and this may not be a crazy as it seems at first glance, but it does cause
software to freak out. But, as I understand it, WSL didn't even have a user
account until recently, so they seem to be making it better on that front. In
the meantime, I wouldn't want to rely on it for anything important.

That said, it gets a lot right. It feels like magic to run nearly any Linux
application and have it Just Work. I, admittedly, am only running text mode
apps at the moment: vim, bash, git, Perl, Ruby, Node. I haven't tried any
graphical apps, so far. But, that's enough to replicate most of my workflow
for developing server apps, and I don't need a VM to do it.

I don't plan to stick with Windows, even now, but it's been fun playing with
it, and seeing what Windows is like these days. It's pretty nice, honestly. If
I were just starting out with computers, I'd probably have no strong need to
move to Linux in order to be productive. I'd learn how to use Powershell
effectively (though it's gotten a lot easier/nicer in recent years, and
accepts many of the common commands a UNIX user would expect, like ls, cd, cp,
mv, etc...last time I used it many years ago, every command was some "Stupid-
Long-Ass-Thing WithBIzarreLY cApitalized-OptioNS"), and probably be happy with
Windows as a development platform.

As an aside, the Windows side of other kinds of development has also gotten
_remarkably_ better since I last tried it. Perl runs wonderfully right out of
the box including some XS (compiled) modules, with Strawberry Perl,
RubyInstaller does the same for Ruby, Python has always been great on Windows
and still is, PostgreSQL works fine, git works mostly fine (though I guess
some kinds of filename that are OK on Linux are problems on Windows), SQLite
is great (as expected, since it is used by tons of Windows software, including
stuff from Microsoft themselves, I think), ack works fine, etc. We've kind of
entered a golden age where your desktop environment does not prevent you from
working together with people using other desktop environments; they
interoperate very easily for the most part, particularly with common points of
ingress/egress (github or gitlab, for example).

~~~
mannimow
You are talking about enabling insider preview which takes around a day to
kick in and offer you the update. Since bash on windows is not included on the
stable "branch" you have to go through the hoops to get it. This has nothing
to do with the feature itself, which takes even less to install than pulling
the Ubuntu image off docker hub.

~~~
SwellJoe
I found it really clunky. I wanted a thing, and it made me wait nearly two
days to get that thing; and it was confusing, to boot; I kept following the
instructions and not seeing the service I expected to see. I now understand
the process and what it was doing during all that time (er, actually, I still
don't know what it was doing during all that time, but I understand it was
working as designed in making me wait), I just think it is a clunky process
that exhibits one of the bigger weaknesses of Windows. Windows simply handles
updates and packages extremely poorly compared to Linux.

It's interesting that the answers I've gotten about it being a poor user
experience are all basically of the form, "No, that's how it is supposed to
work. It isn't a poor user experience." Have y'all not used Linux before? I
mean, apt-get and yum are really something special, if you're coming from
systems (like Windows or Mac OS) that don't have good package management.
Having one universal method to install and update everything on your system,
including OS updates, is just wonderful.

Nonetheless, Windows 10 is the best Windows I've used (ignoring the privacy
concerns among other things), and I like WSL. It's cool technology and fun to
play with. I'm probably installing Linux tonight or tomorrow, but it was a fun
week of tinkering with something new to me.

~~~
ctolkien
>I found it really clunky. I wanted a thing, and it made me wait nearly two
days to get that thing

That "thing" isn't officially released yet, hence the hoops.

------
dan-silver
Looks like the comment on their warning isn't rendering html? Hopefully people
still see this :) $ rm -rf /mnt/c/ <strong>[DO NOT DO THIS]</strong>

~~~
SturgeonsLaw
I hope that results in a malformed command, should anyone try and paste it in.
Not gonna test it myself though :)

------
DocG
How stable is it? I've been playing around with the idea installing it on my
only (dev)machine. I dont expect the ubuntu subsystem to work perfectly but my
old workflow to be stable.

Edit: I am regularly suprised that nano filename does not open quick edit in
my machine. And then I remeber I am working in my local machine.

~~~
dingo_bat
It's pretty stable. But also pretty useless. Fun to play around and use a bit
of byobu. I had a repo that wouldn't check out in windows because of some file
names. But bash on Ubuntu on Windows worked like a champ.

But as I said, the utility is limited. If you really need the Linux kernel,
this is useless. If you don't, then everything is already available on Windows
natively.

~~~
supernovae
THis makes no sense.. Most people don't comprehend that it's not just bash,
its the entire Ubuntu user space. You can run Ubuntu apps just by running apt-
get. VI, Ruby, Golang, Rust. You can set Bash as your debug shell in VS Code,
you can have all your familiar SSH keys/forwarding/scp tools.. Of course there
is a ton of windows native stuff, but in essence this makes Linux native so
now you have just that much more.

~~~
dingo_bat
>You can run Ubuntu apps just by running apt-get. VI, Ruby, Golang, Rust

But I already have vim, ruby, golang and rust natively on Windows. I agree
it's cool. But still pointless.

>You can set Bash as your debug shell in VS Code, you can have all your
familiar SSH keys/forwarding/scp tools.

I can install vscode on Linux directly. And again, ssh, scp, etc is already
there on Windows.

~~~
GeorgeHahn
I think many of us who use Windows take for granted the number of tools we use
to cover over our pain points.

I use Msys2, Cmder, a bunch of custom tool builds, and some Powershell
scripts. This setup works great; I'm productive with it and my command line
feels fantastic. However, I have been tweaking my setup for years. WSL makes
all of that learning, setup, and tweaking unnecessary.

All of your tools are available out of the box, and you don't have to
configure anything, hunt down binaries, or make your own builds.

This isn't about making you and I more comfortable - we already are. This is
about making it easier for other devs to find a happy setup on Windows.

------
gremlinsinc
I'd rather a linux sub sys for windows -- gamers on linux would flock to it,
wine sux. There's some nice windows apps, and niche things built only on
windows -- but I've staying on Ubuntu most likely.

~~~
SwellJoe
I don't think that's fair to Wine. It is tackling a _huge_ problem space,
without a specification or source to work with. They're reverse engineering
vast swaths of Windows. I think Wine works remarkably well given the size and
scope of the project, and the nature of Windows being a huge moving target.

Steam has _so many_ games for Linux now, and a lot of that is due to Wine
having advanced to the point where porting to Linux has become relatively
trivial. Wine basically has allowed me to go years between reboots into
Windows on my previous laptop; and I expect once I get Linux installed on my
new laptop, I won't need to reboot into Windows again for another year or two
or three. My favorite games are all working on Linux, mostly because of Wine
(I don't run them explicitly under Wine, but a lot of the ports on Steam are
using Wine behind the scenes).

~~~
gremlinsinc
I'm just saying WOW is buggy on linux wine, etc.. -- I think if windows
officially had their own wine-alternative with proprietary drivers, dlls, etc
--it would open a whole new world of cross-platform use.

~~~
SwellJoe
WSL is also buggy as hell, so there's that. It's seemingly a hard problem
either direction, but I think probably harder for Wine.

------
newman314
This is nice and all but I'm much more interested in the inverse use case:
managing Windows servers through ssh and bash. For example, it would make
loading Let's Encrypt certs much easier.

------
kevindong
I found that blog post to be very disappointing. It didn't really demonstrate
a meaningful use case for WSL (i.e. programming in C by compiling with gcc). I
think that blog post is mostly made for tech journalists who aren't actually
very techy. For example, the author used nano to copy and paste in a Python
script. There's a two things wrong with that: 1) he used nano for
"programming" (regardless of which text editor you use, I think we can all
agree that nano definitely shouldn't be used for programming) and 2) Python
already has native support on Windows.

~~~
nitinreddy88
You need to re-read the post

"It’s not about replacing other Windows-native tools such as Python,
PowerShell, C# and more. It’s about removing friction when you just need to
get stuff done quickly and efficiently in a modern development workflow."

~~~
kevindong
My example was meant to support my assertion that:

> I think that blog post is mostly made for tech journalists who aren't
> actually very techy.

\---

This statement:

> This is definitely a “by developers, for developers” Windows 10 feature,
> specifically designed to remove a bit of friction from developers’ daily
> workflow.

reads like a press release. I agree that implementing WSL will reduce
"friction from developers' daily workflow", but the article did a fairly poor
job at demonstrating that.

~~~
sbuttgereit
I think you're right though I wasn't disappointed by the fact. I saw quickly
that the audience wasn't me and kept reading for curiosity's sake... to test
who they're trying to reach.

There's probably a fair number of Windows only people that the whole Linux
ecosystem is something new and foreign; especially sysadmin and corporate IT
types that have heard about this, but may not know anything about it... I
expect there may be some gentle introduction for those types here, too.

------
TheOsiris
lets cut to the chase, does tmux work on wsl?

~~~
SwellJoe
Yep, works perfectly. Some terminal emulators on Windows suck up some command
key combinations which might impede use of tmux or others that need those key
combos, but that's usually configurable.

~~~
supernintendo
This is not a unique problem to Windows, btw. I use tmux with alt + tilde (`)
as my modifier key, and most terminal emulators need config changes to allow
this.

