As a full-stack developer in LAMP, I often play-around with Linux servers.
Unfortunately, there are always some reason that I can’t switch to Linux development machine.
E.g. Windows only printer drivers, Adobe Software, exe…
However, Windows cmd/PowerShell always disgust me for their special syntax.
And I missed Unix-like CLI tools such as (
ssh…) so much.
Plus you can’t use
id_rsa format in Windows directly (You will need putty, a GUI tool for CLI… and you need to convert all your keys)
So today we will get those lovely tools back, on Windows!
(Does NOT require Windows 10 Ubuntu Bash, should work on any supported version of Windows)
- Install Git for Windows
No matter if you use Git, you will need to install it.
Git for Windows installation includes a very nice Bash environment (In form of MinGW)
https://git-scm.com/During the installation, those options are recommend, otherwise keep the default option.
- Meet the bash shell
Now right click on any folder in Windows Explorer, a nice bash shell is waiting for you
You can right click on the title bar to set windows/font size and other settings.
- Know about the path structure
Bash in Windows is base on MinGW, it’s not an emulator, but a compatibility layer to make Windows environment POSIX compatible.
Maybe too complicated, let’s forgot it. What you need to know first is the path used in this Bash
e.g. To change working directory to
C:\Windows\, you will need to
cd /c/windows(Yes, it’s case Insensitive)
C:\Apache\htdocs\phpinfo.php, you will need to
- What about ssh?
That’s what I need the most.
Firstly, we can now use
ssh-keygento generate our public/private pairs like on Unix.
They will be stored in
C:\Users\Tiger\.ssh like path)
id_rsa.pubworks directly without converting in bash!
You can now
ssh email@example.com the need of external tools!
gitworks well in bash.
- Other goodies from Unix
find… works out-out-box
C:\Program Files\Git\usr\binto see what’s available.
You may as well, add your favorite CLI tools to Windows Environment Path.
MinGW bash does pick them up, after a computer restart.
~/.bashrcworks, tab-completions are awesome just like on Linux.