The easiest way to use Bash shell on Windows

The easiest way to use Bash shell on Windows

I want to use the bash shell on windows in place of the command prompt. I’ve tried the Linux subsystem for Windows and it’s not what I’m looking for and Cygwin just doesn’t feel right. My search led me to the Git Bash shell bundled with Git for Windows.

This article is about how to install git bash and customize it.

To clarify, the bash shell included in Git for Windows is actually mingw64. Mingw64 has a windows installer here but I really like the “Git Bash Here” shell extension you get when you install Git for Windows.

git bash here right click


How to Install Git Bash (Method 1 via choco)

  1. Install Chocolatey
  2. Open a privileged Command Prompt window
  3. Install Git for Windows using choco
    choco install git -y

or just Install Git for Windows (Method 2, traditional install)

  1. Navigate to gitforwindows.org
  2. Download and Run the Installer
  3. Make sure [*] Git Bash Here is checked
    git-for-windows-install-select-components

Launching Git Bash

From the Start Menu

  1. Click Start and type “bash”
  2. Click Git Bash
    launch_git_bash_start_menu

From Windows Explorer

  1. Open Windows Explorer
  2. Navigate to your target folder
  3. Right-click on the folder and choose “Git Bash Here”
    git bash here right click

From an existing Command Prompt window

For this method to work you must add C:\Program Files\Git\usr\bin to your PATH
From an command prompt just type bash

Customizing the bash prompt

The default prompt for Git Bash was a bit odd but you can change it just like on linux.

export PS1=”pwd #”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.