This is probably the most annoying thing with Windows – awful console (prompt). I do have Windows on one of my computers that I do developing stuff, and I just can not work with standard console. I used to like Cygwin, but there is something putting me off with it. I don’t like how it map drives and furthermore somehow it feels almost like it’s a console to a virtual machine. It is a good peace of software, no doubt but I needed something that ‘feels’ better on Windows and hopefully gives me that bash feeling.

I played around with many alternatives. Console2, Ansicon (not really a alternative it’s just a wrapper), Powershell and some other that I forgot the name now. Installed each one and fiddled with them. Nothing felt right. Then I remembered that I actually liked git-bash when I tried it couple of months ago. That’s a pretty ‘competent’ bash. Not as advanced as Cygwin and not that primitive as Windows prompt. I wrapped Git-bash with Con-emu (brilliant console wrapper!) and that was the jackpot!

(Quick reminder for ConEmu settings) Add a new task under ‘Startup’ and name it something like ‘Git Bash’ and add a command:

“C:Program Files (x86)Gitbinsh.exe” –login -i

skip task parameters; none needed. In ‘Startup’ chose ‘Specified named task’ and then choose your freshly created task. This will start GitBash as default console. Similar procedure can be done under ‘Integration’ for e.g. right click in explorer (think: ‘open console here..’).

In settings for Con-Emu edit the ‘Tab bar’ -> Console to ‘%m◉m %n | %f’. This will show the active process (neat when you quickly want to distinguish between locally running bash vs ssh) and current folder your in, separated by pipe character.

Git-bash supports .bashrc config so I just throw a simplest possible in the home folder. Something like this:

# /etc/bash.bashrc

alias ls="ls --color=auto"
alias dir="dir --color=auto"
alias grep="grep --color=auto"
alias dmesg='dmesg --color'

# customize the prompt
PS1="e[00;33mwe[00mn$ "

## get rid of command not found ##
alias cd..='cd ..'
## a quick way to get out of current directory ##
alias ..='cd ..'
alias ..='cd ..'
alias ...='cd ../../../'
alias ....='cd ../../../../'
alias .....='cd ../../../../'

# I like me some ll stuff
alias ll="ls -ltr"
alias la="ls -A"
alias l="ls -CF"
alias tailf="tail -f"

And Cygwin has one neat ‘clear’ function that is nice to have. So lets add it here to our conf:

alias clear='printf "e[He[2J"'

And this feels now like something I can actually work with. Comfortably!

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.