Every developer who has worked for some time on Linux or another Un*x system will miss the bash, some of the other unix tools like find, cat, grep and awk and a decent console bitterly.
There are several ways how to get some of the unix power back to windows.
- Cygwin. It is sometimes a bit complicated to install and handle and there are often problems with line endings. I have used this but never was really totally content.
- MinGW, MSYS and MSYS2. I have never used them and cannot tell much about them.
- Git-Bash and ConEmu. Lately I have detetcted these tools and it seems they are working quite well. In this post, I’ll go a bit deeper on them. Git-Bash is a version of mingw32, as far as I know.
Git is a well known source control system. And its installation kit for windows contains bash, awk, grep, find and several other unix tools. So even if you don’t want to use git on your windows machine, you can install this package. It is free software.
Installation (with Git 1.9.5 from 2015/03/19) goes like this:
- Download the git package for windows.
- Run the installer.
- Install it to
- Leave away Windows Explorer integration. Do not associate file endings. Next.
- Do not create a start menu folder. Next.
- Use Git from Git Bash only. (Other options didn’t work as intended anyway.)
- Next. Check out Windows-style, commit Unix-style line endings.
- Next. Wait. Finish.
- Install it to
- Create a home directory for your unix tools where you like it. Create an environment variable called
HOMEpointing to this directory.
- Add to your
PATHenvironment variable the directory
- Into the directory pointed to by HOME, put a
.bashrcwith some aliases.
- Make sure that your
.bashrccontains this line:
This makes sure that the bash tools
sortare in the PATH before the windows tools with the same names.
- Set the Double Commander terminal command to
- Done and works. Now you’ve got a usable bash with pipes and filters, awk, find, grep etc available.
ConEmu is a very fine terminal emulator. Download the ConEmu portable package. It’s got dozens of settings and it can be used for any consoles on windows, not only the bash. E.g. it can be used with the ordinary
Here is how to install it:
- Download the portable version of ConEmu.
- Extract it beneath the Git directory, to
- Run ConEmu.exe or ConEmu64.exe, depending on your system. Delete the other one.
- Select as settings location
- As startup task select
- Done. Now you’ve got a nice looking console window with your git-bash inside. And for the occasional case you still need a cmd console, you can start this also inside ConEmu.
- And the best, you have all these things in the console you’ve missed your whole life:
- You can copy text to the clipboard by just marking it.
- You can insert text by typing
Ctrl-v. Yes, really. No need to
- You can resize even the width of the window by dragging at the corner. Shocking.
- ConEmu remembers its position and size and reopens at the previous place
- There are dozens of other settings and possibilities for configuration with which you can play if you’d like to.
- Set the Double Commander terminal command to:
I’ve got the idea of combining ConEmu with Git on Windows from this post.
Things I like to have in my .bashrc:
PATH=/bin:$PATH alias cd='pushd' alias -- -='popd' alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' alias ls='ls -ACF' alias ll='ls -l' alias no='notepad++'