Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Is Bash for Windows good enough to replace a Linux/Mac terminal?
45 points by jiantastic on Oct 28, 2016 | hide | past | favorite | 48 comments
I know the Interop feature is coming to Bash for Windows (https://blogs.msdn.microsoft.com/commandline/2016/10/19/interop-between-windows-and-bash/) which to me seems to solve the complaints I had with the initial implementation.

Can anyone comment on their experiences using Bash for Windows for development full-time?

Thanks!




I've been watching the whole Bash on Windows thing since it launched and it blows my mind in almost every possible way, the project has all the potential to make Windows a viable programming environment, specially for PHP and Ruby folks, which need to run Apache and all that stuff.

It won't replace a full Linux install, but it might be enough for most use cases (it doesn't run X yet, for example). So virtual machines aren't exactly going to be replaced by Bash on Windows.

But for people who buy Macs just because it is a Unix machine that runs Photoshop, and use Homebrew and Macports, which let's be clear apt-get wins hands-down, Bash on Windows is a strong alternative for these types of users.

I own a Macbook Air 2011, Apple prices skyrocketed in Brazil and for me to pay that price on a machine that has soldered RAM, almost no ports, having to buy expensive adapters, to use a shitty package manager with an OS that makes me dual-boot with Windows/Linux for some things, I am definitely considering a Lenovo or Dell machine with Windows for my next development environment.

Of course, not all things are perfect, while the project seems to be moving at an awesome pace and the future is bright, it is still in Beta, and lots of things are broken for now, if it becomes as stable as it should be, it will be big. I am eagerly waiting for the stable version of it.


It is possible to run X programs with Bash on Windows. You need to run a Windows port of an X server, like Xming[1]. Even programs like Firefox work, though it's a bit laggy. It's good enough to run gvim, though.

[1]: https://sourceforge.net/projects/xming/


Yup, it's great for non GUI development and scripts. I use it daily and haven't had anything not work yet other than GUIs, but that's expected.


In short: yes. I recently went through this with a new work laptop.

I checked a couple boxes, restarted, and installed ConEmu.

I added symlinks in my bash home directory for "c", "docs", and "downloads", and pinned my Linux installation as a favorite in Windows Explorer, which makes file management between the two systems incredibly easy.

I installed git, and zsh, and a lot of the other basics. Zero issues. It's a normal Ubuntu installation.

I've been thrilled with it, so much so that I just plunked down some money for my first Windows laptop in years, and I'm selling my old Macbook Pro.

It's the real deal. Microsoft is on fire lately.


And recent insider update lets you install ubuntu 16.04 and run Windows commands from bash. Neat.


I have not tried Bash for Windows, but I've been a Cygwin user for almost a decade.

The main problem I have with using any kind of shell on Windows is that process spawning takes much, much longer than on *nix systems. I regularly find myself optimizing my scripts not for readability or elegance, but for total number of calls to executables.

To illustrate, opening a new Cygwin Bash shell on this machine takes 3 seconds, almost all of which is spent executing .bashrc. On Linux, with the same .bashrc (modulo a few platform-specific settings) that's under 0.2 seconds.

So, far from perfect, but is it 'good enough'? I'd say yes. Bash is just so much nicer than CMD, and while I hear good things about PowerShell, I can't be bothered to learn a different shell for every platform I use.

Whether there are additional tradeoffs with Bash for Windows, I cannot judge.


One cannot infer the behaviour of the Windows Subsystem for Linux from the behaviour of Cygwin. The two are quite different things.

You're also being misled by the misleading "Bash on Windows" marketing name. It's not bash, even primarily. It's a "personality" subsystem for running Linux binaries on top of the Windows NT kernel. And that's what jiantastic is asking about: whether the subsystem, with what Linux programs it can run and what limitations it has, is "good enough" as a development environment, which includes considering everything from running compilers to hosting test rigs. Xe is not asking whether the Bourne Again shell is better than some other command interpreter.


It's actually not bashrc that is the direct culprit but a few issues with how Cygwin emulates posix.

Best solution is to edit /etc/bash_completion.d and remove anything you don't need this can shave off 2-3 seconds of the load time.

Since windows now should have a native fork() call Cygwin might be updated on its own which will make it about as fast as a native nix system, that said Cygwin will need to make a dedicated version for windows 10 for this to work.


I remember I cut down a lot of the cyg shell startup time by removing a lot of the completion files I wasn't actively using from .bashrc.

But yes, it is generally slower. I'm much happier to be back to Linux these days.


There's also Babun[1] which is a pre-configured Cygwin with a lot of addons as they say themselves. It also uses oh-my-zhs.

When I have to use a Windows OS for some reason I install this, it at least makes me feel a little bit at home.

[1]http://babun.github.io/


My experience and usecase is limited - I just use my Windows machine for game development - but I’ve dealt with more headaches trying to get Bash for Windows + git to play nice with Unity that I’ve just gone back to using Git for Windows and its bash exe.

Probably the weirdest problem I’ve ran into are shader files in my git repo being locked to requiring administrative rights for either Unity or Bash for Windows to be able to open them.


@eswat : So long as your shader files are stored in a non-protected folder (e.g. C:\Windows, C:\Program Files, etc.), you shouldn't need Admin rights to load them.


It's not 100% there yet but it's pretty damn close for me. If you are set on running a stable build of Windows then there are still some bugs out there that range from annoying to possible deal breakers. The two that come to mind is the stable version doesn't support 256 colors (annoyance) but then there are issues like this that stop me from being able to totally use go: https://github.com/Microsoft/BashOnWindows/issues/638

Most of these are fixed in the insider builds of Windows but that means you have to run full insider builds, you can't pick and choose components, so sometimes that is a non-starter for people.

Some of the annoying (color, cut & paste, etc) things can be fixed by using something like ConEmu (what I use).

I've actually stopped using my macbook and am now just using my company provided Windows machine for day-to-day stuff and it's been pretty smooth for the most part.

full disclosure: I work at Microsoft


If you're switching platforms you should test the software you plan to run, there are still some small gaps that may kill your workflow (eg zeromq doesn't run out of the box, which means jupyter doesn't either).

It's been pretty good to me, but I'm normally a Windows user, so roadblocks in WSL just send me back to my old workflows rather than causing me headaches.


I have tried using it for the past couple of weeks, and had to fiddle a lot for the first week or so to get it working nicely. The package state is stuck at 14.04 but you can upgrade[0] to 16.04 with dirty[1] trick. After the initial setup, Windows Bash worked just fine for my Rust / Go / Python needs.

What would you mainly use the bash environment for ?

[0](http://www.omgubuntu.co.uk/2016/08/upgrade-bash-windows-10-u...) [1](https://github.com/Microsoft/BashOnWindows/issues/482#issuec...)


You can install 16.04 now, but you have to blow away your Linux install to do so https://blogs.msdn.microsoft.com/commandline/2016/10/19/wsl-...


I didn't have to. Upgraded nicely using do release upgrade


What exactly are people using the linux shell for? It's fun, but given that you can't easily access windows files and you can't use it to run things like the visual C++ compiler you can't easily use it to script windows programs.

What do people actually use it for?


Bash <--> Windows interop arrived in build #14951: https://blogs.msdn.microsoft.com/commandline/2016/10/19/inte... allowing you to call Windows apps from within bash, and capture and process the output of Bash scripts and/or Linux tools from Windows.

What else can you use Bash for? Using apt-get to install your favorite dev tools, libraries, platforms and languages inc. node.js, Ruby, Python, gcc, go, Rust, htop, Apache, MySQL, Jekyll, etc., and then building and running your code with little/no change vs. running on Linux natively.


You absolutely can access files from the Windows filesystems easily. The C: drive is mounted at /mnt/c by default. The ability to launch native Windows programs from within WSL is being delivered as part of the next update and is available on Insider builds now.


I've been cross compiling OpenWRT for Mips in my WSL, which is very handy!


Personally, I dislike it. I have been a Cygwin user for a few years and I desperately want to like LSFW, but I just can't. I find the customization options of Cygwin to be much more and I can get things like Tmux working on it without any issues.

I also have a ton of docker compatibility issues when trying to work with containers, ultimately I just wrote a power shell script to get my docker-compose environment up and running and go from there.

As far as I know, you also can't run nginx on port 80 which makes it challenging for web development (i'm sure I can run things on different ports, but who wants to do that).

I think it's promoting, but not quite ready to replace my MacBook & Linux partitions yet.


I've been using it for some web development tasks. Mainly for git, ssh, perusing my file system, and PHP/Python programming. It's worked well so far.

For a terminal emulator, I set up Conemu (https://conemu.github.io/) which is pretty swell.

I hit a road block when I need to use vagrant for my development environment. I need to hop into powershell to fire up vagrant as virtualization doesn't seem to work in WSL. Otherwise it seems to work for most of my use cases.


In the latest build you can run Windows executables directly from bash so you can run vagrant from the windows installation without switching shell.


I've been using Bash for Windows at work for a couple of months, and it's mostly been good enough that I don't need to fire up my ubuntu vm anymore.

The biggest problem I've run into lately is that I really want to be able to run GUI-based programs, and even though that does worth with VcXWin, it's kind of crappy, especially for font rendering.

Anyone know of a free (or cheap) x window server for windows that does anti-aliasing?


I wonder if MS finds a way to port open source Linux apps in Windows 10.


Isn't WSL the shotgun approach to answer your question? There's no need to port thousands of useful tools; create the WSL and poof! most of it runs out of the box, natively, in Windows.


[flagged]



Last I tried, absolutely not. There is a bug with TCP/IP that apparently prevents nodejs from doing anything networking related. So for example, express will not run because it can't find to the port to listen for HTTP.

Its been documented and seemingly ignored by the bash team every time I've checked so I may stuck sticking with a laptop that doesn't have an escape key.. :(

Proceed with caution, for now.


It's actually not being ignored, the fix is in active development: https://github.com/Microsoft/BashOnWindows/issues/468#issuec...


I do scientific programming using FORTRAN 90 and Python. I am Windows Insider with fast build releases set up in my Dell XPS. For my needs it has served well. But I request MS developers to give more control over how to utilize system resources more efficiently. It needs to be more transparent and documented for users of procexp.


A change in a recent build lets you see which particular OS process is using the CPU instead of previously all being combined into one.

I know this is not exactly what you are looking for but it's a step in the right direction.


Bash for Windows is open source, right?

Is there anyway for me to get just bash binary to run? or build it from source and run it instead sign up for the insider program.

I tried to signed up as insider a few times on couple win 10 systems, failed and completely gave up on that.


You don't need to be an insider to run it. It is available in the current version of Windows 10 (Build 1607 - AKA Anniversary Update). Then go to `Settings -> Update and Security -> For Developers -> Developer Mode`. Next, search for `Optional Features` Start Menu (Just start typing that in the Start Menu, it will show up) and check the box next to `Bash for Windows`.


You're being misled by the misleading marketing name, too. This isn't the Bourne Again shell at all. It's a "personality" subsystem that lets one run Linux binaries directly on top of the Windows NT kernel. One of those binaries may well be the Bourne Again shell, but that is largely irrelevant. The Bourne Again shell binary comes from Canonical (or from RedHat if, say, you choose to experiment with running Fedora on the Windows Subsystem for Linux).

The part that comes from Microsoft is the Windows Subsystem for Linux, and of course the Windows NT kernel beneath it (and the Win32 subsystem alongside it). Unless something has changed recently, that is not open source.


I used it at work last summer, and it was fine-- did everything you'd expect it to, etc. I found that I missed my Mac for a few reasons, but those seem to be mostly idiosyncratic.


But.. Why.. Why would you want to do that. And I am not asking to be clever. I just can't imagine why anyone wouldn't just run Linux?


Then that's a major failure of imagination. (-:

It's actually quite easy to imagine scenarios such as it is not your computer and the person whose computer it is (such as an employer) requires for whatever reasons that it run Windows.

That said, it should be noted that in many discussions of the Windows Subsystem for Linux people have observed that this is not being aimed at people who run Linux. This is being aimed at people who would otherwise be migrating from Windows to (say) a Mac. (And also at those who have already migrated, and might be reconsidering migrating back.)

For those people, jiantastic's question is important. They want to know whether their needs can be met by staying on Windows and using the Windows Subsystem for Linux, whether it is "good enough" as a development environment to do all of the things that they may need to do as a developer (from installing and running development tools to hosting test rigs), or whether it doesn't meet those needs and they should instead consider the more drastic course of replacing Windows with something else.


I can do almost everything I want in bash except run anything that needs a list of network interfaces. I would like to run gulp with browsersync.


Why not a Virtual Machine on your PC?


A virtual machine is a hideous amount of overhead for a shell, not least because a lot of people like to drop to a shell specifically for its low resource consumption for large tasks. It's a valid solution, yes, but I would rank it below Bash on Windows 10 in any form.


For my use case I would prefer to have 100% of system resources on one OS. Also, I'm coming from a Mac and would prefer the "integrated" feel if that makes sense


The VM's are amazing.

You don't have to dual boot.

You can have on one screen Ubuntu, on the other, windows. So you can use all your photoshoppy design programs on windows and the best coding on linux.

Best of both worlds.

You can also intall cygwin in windows which gives you a terminal on windows. Although there may be be a better program now than cygwin

Also, not sure if this is any good: http://www.pcworld.com/article/3106463/windows/how-to-get-ba...


> You can also intall cygwin in windows which gives you a terminal on windows. Although there may be be a better program now than cygwin

Yes, like WSL, which OP is asking.


Nothing wrong with broadening an answer, no need to be black and white. Cygwin has been around for ages.


There's a big difference between Cygwin and Bash on Windows though: Cygwin is a Win32 port of the GNU tools, whereas Bash on Windows is a Linux kernel emulation layer that allows you to run unmodified Linux binaries directly on Windows.


You could make it the other way around. Install Linux and use KVM to have a windows virtual machine at almost 100% native speed and basically full access to the hardware.

The only difficulty is if the hardware doesn't fully support Linux without hassle (in very recent notebooks for instance).





Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: