If you want to do as you've stated, I would recommend using CYGWIN.
The installer is mature and lets you choose what commands and functions you want. The defaults will get you pretty much anything you would need and then you can extend and tweak later on.
First you need to understand the difference between a Terminal and a command environment (AKA "shell"). The former allows access to a remote or local system at a low level, the latter is what is run when you connect via the terminal. This is true across all systems it is just rather better hidden in some than others. It is also worth noting that command environments contain built-in commands such as the UNIXy ls
and the DOSy dir
but that all systems have other "command line" tools, for example ifconfig
on Linux and ipconfig.exe
on Windows. It can be hard to differentiate between them but you will sometimes get tripped up when trying to execute a UNIXy command on Windows. Many of the best UNIXy command line tools are also available for Windows however, either through CYGWIN itself or via native versions. For example, the excellent exiftool
that I use for batch renaming photo's on both Linux and Windows.
So you are able to replace the terminal with something more fully featured if you need it such as Lterm2 on your Mac, even Windows has a couple of alternatives though personally I wouldn't bother - more trouble than its worth.
On Windows (newer versions anyway), the default command environment is cmd.exe
. It is nowhere near a featureful as it's Linux equivalent BASH
. On Linux, BASH is the most common standard but you may come across others such as ASH
, Korn Shell, SH
and others. Windows actually provides several other command shells, the most common and powerful being PowerShell. PowerShell is so powerful because it is able to use and expose interfaces for most of the .NET libraries of which there are a great many doing all sorts of clever things. It is also Microsoft's chosen administrative shell so you use it for maintaining remote systems (both servers and clients) and even cloud services such as Office 365 and Azure. If you want to be a Windows system GURU, PowerShell is essential learning.
Back to your question though. You can easily run BASH via CYGWIN which installs it and a number of supporting commands. CYGWIN not only gives you a UNIXy way of interacting with drives, files and folders on Windows machines, it also makes available things like the Windows Registry in like manner.
Of course, there are other limits. For starters, the folder layout on Windows will always be different to Linux or MAC hosts and you will have to allow for that in any scripts that you write if you want them to work across all platforms.
You can, of course, continue to use gitBASH but you are likely to find that it doesn't have some of the commands you might expect to be available. You would have to just try it and see. If you do go down that path, when you find a missing command, you can just search for it online, it may be available as a native Windows executable and therefore should be usable from gitBASH if placed in a folder on your PATH.
Clarification 1: If you are used to Linux, you will be familiar with the fact that each distribution has a "package manager" that helps with the installation of software from recognised & (hopefully) trusted sources. They help ensure that you have all of the components and dependencies required. CYGWIN uses its "installer" for the same purpose though it is a lot simpler. Remember, most Linux tools are compiled for use on Linux (generally you need to know the type of processor you are using plus you need a load of internal dependencies from the Linux "Kernel"). To use Linux commands on Windows requires that they all get recompiled to work on a Windows platform. There is a helper library that allows this to be relatively painless (MSYS? anyway, you don't really need to know that).
You are correct in saying that Chocolatey is an attempt at a package manager for Windows. One of Windows' great failings is the lack of a single, trusted, recognised package source - or "App Store" as is now the craze for calling these things! With W8, Microsoft are trying (not all that well it has to be said) to rectify that but currently it is very limited - aimed at mobile and ModernUI apps.
However, many Windows developers have long used a tool called NUGET to help package up applications for installing on Windows. NUGET makes use of PowerShell behind the scenes. Chocolately is a set of scripts built using PowerShell and NUGET to help automate installations. It works OK but still doesn't command the widespread support it should probably have. It is easy enough to create install packages for Chocolatey, I did my first a couple of weeks ago for the Open Source Freeplane mind-mapping tool.
But, as you say, there is no connection at all between Chocolatey (using PowerShell) and BASH on CYGWIN. In your example, you will need to decide where and how you want to use VIM. If you only ever want to use it in the context of CYGWIN then install it via the CYGWIN installer. However, if you want to use it as a general Windows editor, you might be better off installing via Chocolatey. Unfortunately, there is no easy way to predict which would be best. You might even end up doing both. On the other hand, you might find some Windows applications also work fine when called from BASH and others won't!! Pain huh!
UPDATE 2: Did I mention you should stick to PowerShell!! Welcome to the world of cross platform working. CYGWIN wants its own Python package installing to satisfy internal dependencies. Using native Windows Python (such as installed through Chocolately, or manually) might work but then again might not. No easy way of telling but it is highly likely that you will hit a problem eventually if you don't have the Cygwin package installed. This is why someone else recommended using a virtual machine instead so that you keep things clean and separate.
Honestly, you might be better off accepting that you need to learn different tools for different platforms. It isn't that hard. It really depends on what you want to do. If you want to learn Linux command line, use a virtual machine. If you want to automate Windows tasks, learn PowerShell or alternatively, if you already know Python, use that instead! So many options!
if you have cygwin installed you probably don't need gitbash which i guess is installed when you install windows git. My suggestion is to uninstall all the unixy programs like git that you installed without cygwin, then install them via cygwin and stick with cygwin.
then do a tutorial on the unix command line. a quick google yielded this link: http://www.ee.surrey.ac.uk/Teaching/Unix/unix1.html
but even better would be to install a proper unix/linux environment. you could do that in a virtual machine if you don't want to dual boot or overwrite your windows install – Jason Lewis – 2014-05-29T13:55:05.427
Thanks @JasonLewis. When you say 'install them via cygwin' - I get a little confused. As far as I am aware, we can install stuff via package managers and such... so what do you mean install via cygwin? Thanks! – TheGrapeBeyond – 2014-05-29T14:01:46.570
re-run the cygwin setup.exe command and select anything you want that is missing, for example git http://stackoverflow.com/questions/15692890/running-git-through-cygwin-from-windows
– Jason Lewis – 2014-05-29T14:03:22.780http://superuser.com/questions/304541/how-to-install-new-packages-on-cygwin – Jason Lewis – 2014-05-29T14:03:59.347
Cygwin has its own "package manager" that you run. They just call it their installer. You won't be able to run LINUX type package managers such as
apt
oripkg
from CYGWIN as they are too integrated to the platform. – Julian Knight – 2014-05-29T14:13:38.020