Dealing with PATH and Bash in Windows 10

This post serves as a convenience reminder to myself and possibly others on how to manage working within Git Bash and Command Line in general within Windows 10. It can be a real pain in the neck to deal with PATH.

Git Bash Notes:

Windows PATH Tips/Instructions:

  • Control Panel > System > Advanced > Environment Variables
  • Edit Path to add a folder or System Variable
    • Add a folder: Point the resource you need by adding a folder path without the .exe
    • Add a System Variable: First point the directory and assign a variable name by adding to the System Variables. Next append the name of the variable to the Path ( ex. %JAVA%; ).
  • Windows Environment Variable added without restarting (ha):
  • Add things for convenience like c:/eclipse/ and then simply type eclipse to open the IDE

.bash_profile/.bashrc Examples:

My example .bash_profile:

# Upon open go to my dev directory
 cd 'C:\Users\AlexanderRamsey\dev'

# Launch Sublime in current dir
 alias sublime='subl.exe .'
 # Launch python in git bash
 alias pyth='winpty py'
 # Search history. Example usage: histg foo
 alias histg="history | grep"

# Handle history among multiple windows
 # Avoid duplicates
 export HISTCONTROL=ignoredups:erasedups 
 # When the shell exits, append to the history file instead of overwriting it
 shopt -s histappend
 # After each command, append to the history file and reread it
 export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"

Sublime Text Config File

 "font_size": 12,
 "hot_exit": false,
 "remember_open_files": false,
 "tab_size": 4,
 "theme": "Adaptive.sublime-theme"

Or you know, just use Linux.