Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

The question:

Which is better, installing cygwin or one of its cousins on all my windows machines to have a consistent terminal experience across all my development machines, or becoming well trained in the skill of mentally switching from linux terminal to windows command prompt?

Systems I use:

  • OSX Lion on a Macbook Air
  • Windows 8 on a desktop
  • Windows 7 on the same desktop
  • Fedora 16 on the same desktop

What I'm trying to accomplish

Configure an entirely consistent (or consistent enough) terminal experience across all my machines. "enough" in this context is clearly subjective. Please be clear in your answer why the configuration you suggest is consistent enough.

One more thing to keep in mind:

While I do write a lot of code intended to run on Windows (actually code that runs on Windows Phone which necessitates a windows machine), I also write a lot of Java code, and prefer to do so in vim. I test a local repo in Java on my windows machine, and push to another test machine running ubuntu later in the development stage. When I push to the ubuntu machine, I'm exclusively in terminal, since I'm accessing it via SSH.

Summary, with more accurate question:

Is there a good way to accomplish what I'm trying to do, or is it better to get accustomed to remembering different commands based on the system I'm on? Which (if either) is considered "best practice" by the development community?

Alternatively, for a consistent development experience, would it be better to write all my code SSHed into another machine, and move things to windows for compile / build only when I needed to? That seems like too much work... but could be a solution.

Update:

While there are insightful responses below, I have yet to hear an answer that talks about why any given solution is superior. Cygwin/GnuWin32 is certainly a way to accomplish a similar experience on all platforms, but since I'm just learning all things command line, I don't want to set myself up to do a lot of relearning/unlearning in the future.

Cygwin/GnuWin32 has its peculiarities I would imagine, and being aware of how that set up works on Windows is a learning curve. Additionally, using Cygwin/GnuWin32 robs me of learning the benefits of PowerShell.

As a newcomer to working in a command line, which path should I choose to minimize having to relearn/unlearn things in the future? or as my first paragraph poses:

[is it better to use Cygwin] ...or [become] well trained in the skill of mentally switching from linux terminal to windows command prompt?

share|improve this question
4  
Close voters (and everyone else): This may look like a generic foo vs bar not constructive question, but give it a second read, there is an actual practical problem to be solved here. Answerers remember, we don't care what's your favourite way of doing things, we expect you to elaborate on why your answer answers the question. –  Yannis Rizos Apr 27 '12 at 5:46
2  
Ummm, python. Why would you use shell scripting if you need a consistent cross-platform solution? –  Evan Plaice Apr 27 '12 at 6:28
    
@EvanPlaice. Ummm, what? clearly not what I'm looking for in this situation. –  Paul Hazen May 1 '12 at 14:15
add comment

9 Answers

up vote 6 down vote accepted

I ran into this while developing on windows (since I prefer *nix). I used cygwin at first, but eventually switched to gnuwin32 utils. Why?

My users don't have cygwin, and so I had to be proficient in basic window'eze, namely the quirks of the windows cmd prompt, where my programs would run. Powershell may help you as a dev, but I find that the object model does not fit the shell (I use ipython regularly, but not as my shell). There was a blog post on that subject, but I can't remember where it went.

So for a broader language base, learning both systems is good for you. But for an easier time developing (i.e. tool consistency), go with cygwin. Please, please, please be aware though that you will run into horrors coding between the two, see here for an example.

Edit:

As you want examples/proof of which is the better system, I'll expand upon my answer here.

As Matt Might points out here, the shell is very similar to relational algebra. The windows command prompt is like only having access to basic math, no advanced functions. You can sometimes get the same results, but it takes far longer if it is even possible.

Therefore, to even use the basic shell on windows you need access to the unix utilities. Powershell provides most of them, but it moves to a different paradigm. Objects are not the same as the shell. It's like trying to write a functional program with Java, instead of haskell or clisp. Besides that, the interface paradigm ends up being different as well. It is like trying to use the desktop version of ebay, instead of the mobile version on a phone.

That is why you shouldn't use powershell if possible, but as I said previously, you need functionality not native to windows. Normally, these tools are provided by the Visual Studio IDE, which is why that thing is a tank. Of course, that has its own problems. The biggest (far from the only) being it is completely different from the command line, which is what you indicated you wanted.

Your choices thus get narrowed down to gnuwin32 and Cygwin. Gnuwin32 does not sandbox you away from being on windows like Cygwin, and you don't need to learn the odd Cygwin quirks. However, you get to learn some unpleasant surprises, like how windows uses one type of quote. But, Cygwin more closely follows *nix.

The choice ends up hinging on how closely you need to actually work with windows. If you are just on windows, and aren't developing for it in particular, then Cygwin is the better choice. Both for a more homogenous environment, and to avoid the windows quirks in gnuwin32. But, if you need to with windows tools for development (likely for windows phone/ windows 8 dev work), then gnuwin32 will be easier.

Disclaimer:

Most of this is my opinion from having used both systems, for this type of thing. Take it with a grain of salt, and you should probably check both since install is easy.

share|improve this answer
add comment

I would vote for Cygwin.

As well as saving the command history between sessions. You have all the *nix goodies like like grep and awk plus a command shell language that isn't brain dead.

I know powershell is a great improvement on the old DOS prompt, but, why bother learning a new and somewhat limited set of commands when cygwin will give you all that and more.

share|improve this answer
    
Is it possible that the reason I feel the experience is a little quirky on windows due to the fact that I'm probably not running a whole lot of commands, and some of the more simple ones are where the only differences exist? –  Paul Hazen Apr 25 '12 at 1:54
    
when you use cygwin, are there some terminals/clients which are more preferred to others? –  DXM May 1 '12 at 16:54
    
I old fashioned so I just use the plain old "xterm". –  James Anderson May 2 '12 at 2:13
    
btw James, this is a good note, only reason I didn't mark it as the answer was it did not directly answer my question. I didn't do you any favors phrasing it the way I did though. The current updated version of the question is more to-the-point. –  Paul Hazen May 3 '12 at 6:47
add comment

I have a similar problem. Except in my case I develop on Windows and administer Linux servers so I missed the power of *nix commands while on Windows.

I tried Cygwin, but something about it felt unnatural and it ended up being more then I needed so instead I installed the entire suite of GnuWin32 utilities.

I having been using them for the last two years and have been satisfied so far.

As for best practice, I suspect it is more about preference. In your case you could switch to Linux if that is your preferred OS and use a VM for compiling Windows binaries.

share|improve this answer
    
the windows in VM on linux is a smart move, however limitations with the Windows Phone emulator currently don't allow testing while the OS is running on a VM (and I think this is why: goo.gl/9r7OO). I'll look into GnuWin32, could prove to be exactly what I need. –  Paul Hazen Apr 25 '12 at 2:57
    
+1 for mentioning GnuWin32 suite. Would still recommend cygwin just to get the "bash" shell. –  James Anderson Apr 25 '12 at 4:39
    
This is helpful. Closest thing I have to an answer, see my update for why I haven't selected it as THE answer. As a side note, using a VM for compiling Windows binaries is not a suitable option for Windows Phone development. Mainly because running and debugging a phone app in an emulator, or on the phone connected to the VM is not currently a supported scenario for the development tools. Admittedly other Windows projects might work fine with that solution, but I suspect there are good reasons not to use a VM. –  Paul Hazen May 1 '12 at 16:20
    
How about running it the other way around. VM your Linux on Windows, do all of your development in the VM and compile through Windows via a shared folder? It's sort of how I am leaning right now except for anything .NET based. –  Rig May 1 '12 at 18:40
add comment

I would strongly recommend learning the native tools well on the platforms you are to use.

The reason is simple - otherwise the only computers in the whole world you can work on, are the ones you have spent time on setting up yourself. That time may grow quite a bit, and needs to be spent every time you need to access a new computer.

This is very similar to being able to use just about any editor for real work, instead of only being able to use Word because you absolutely NEED grammar check when writing code.

Learn the native tools, and learn them reasonably well.

That said, feel free to have a favorite toolset which you know by heart. Personally I like Perl a lot for picking out information from gigantic logfiles - for that alone I have a Cygwin installation because the standard Windows tools lack here (might be better now, I made that observation back in Windows 2000 days).

share|improve this answer
    
On the flip side, if you only use the native tools of the platform, you won't be able to take advantages of having uniform interface. You won't be able to write a shell script for the repetitive stuffs you need to do; you would need multiple alias definition files one for each platform and make sure they're synchronized. Investing time in learning how to configure your system to your preferences is worthwhile; most people only need to use new computers once in a while, but use the same workstation everyday. –  Lie Ryan May 31 at 4:35
add comment

A partial answer to assembling a cross-platform development environment is to get a good windows editor that recognizes editing files in both MS Windows and *Nix line termination formats.

I think all the Java IDEs do this already (because they don't want to mess with the Java files if they happen to come from the other OS), but don't forget to put the free NotePad++ or the pay UltraEdit (which I used to use all the time, until Eclipse got column mode cut/paste) on your MS Windows box. Otherwise, you'll go crazy editing text files including bash scripts, unless you can make a file have the right line termination with a simple menu selection.

share|improve this answer
add comment

It might be considered "cheating" but often a linux VM (in conjunction with a second screen) works better and faster than cygwin, which can still be used if you don't care about performance and just need it to do something small in a quick and dirty way.

I get the feeling that you don't seem to use Windows enough (at least the terminal portion) to be really comfortable with it. Also, you might want to consider if there are better gui tools for the stuff you were trying to do under Windows. For me, I tend to use the gui tools for ssh and various other things, since the options are greater, even though I am confident with using the native cmd tools available in Windows.

share|improve this answer
add comment

I have been in this situation for many years. I have to work daily in a Windows VM hosted by Mac OS and also work in a separate Linux box. Obviously I can't give you a "right" answer but rather just tell you what works for me. I prefer to use Cygwin precisely because it matches the OSX/Linux terminal experience more closely than Windows. When I try to use CMD.EXE, I find myself slowing down dramatically, using the wrong slashes, typing the wrong commands, etc.

I need to say, though, that my personal intent is to use Windows as little as possible. I was a Windows developer for years, but have now fled that ecosystem and have no intent to go back. If you are instead looking at working primarily in Windows for the long term, it may be better to try to do things "the Windows way".

That said, what I like with Cygwin is not just the continuity in the terminal, but also that things like shell scripts, vim configuration files, etc. work the same, or roughly so. The more open-source, Unixy tools you use, the happier you'll be.

The thing about Cygwin, though, is that there are frustrating differences from bash on OSX/Linux. The mounting is just weird. You can't change the width of your terminal Window. There are lots of permissions gotchas. Really all it buys you is finger memory, not having to remember "dir" rather than "ls".

I've tried other options that use X and frankly found them frustrating as X on Windows is slow and doesn't integrate well with the OS. Or, at least, that was the case when I last tried, which was admittedly years ago.

share|improve this answer
    
You can change the width of the terminal window with Cygwin. Just don't use the brain-dead terminal emulator that comes with Windows, use mintty (distributed with Cygwin, it's derived from PuTTY). –  Gilles Sep 2 '12 at 12:44
    
Really all [cygwin] buys you is finger memory -- So the windows and unix command line tools both make you equally productive if you learn them well? (honest question, I don't know either of them yet) –  Gordon Gustafson Jul 19 '13 at 17:09
add comment

I use Cygwin/Cygwin X and then install Gnome Terminal on top of that.

Gnome Terminal will run on Windows (through Cygwin X), on any Linux, and there is even a way to get it onto Mac OS X following this article here: http://lambie.org/2006/07/08/gnome-terminal-natively-on-mac-os-x/

The reason I recommend Gnome Terminal here is that it can be installed on any platform and it is very easy to use and customize as well as offering other features such as tabbed windows.

share|improve this answer
    
-1 for not answering the question. This is not bad information, but is entirely unhelpful towards the end of the question. –  Paul Hazen May 2 '12 at 18:34
add comment

You might also check out SUA, the Windows Subsystem for Unix Applications. It's part of Windows 7/Vista/Server 2008, just go to Control Panel -> Programs and Features -> Turn Windows Features On and Off and check the box. Afterwards, download the SDK and utilities and you'll be good to go.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.