Skip to content

Instantly share code, notes, and snippets.

@wzup
Last active May 17, 2023 00:49
Show Gist options
  • Save wzup/36b5159d8c580b827384 to your computer and use it in GitHub Desktop.
Save wzup/36b5159d8c580b827384 to your computer and use it in GitHub Desktop.
alias for Git Bash on Windows
# create a file C:\Users\[user]\.bashrc
# add this content
# add your onw aliases or changes these ones as you like
# to make a dot (.bashrs) file in windows, create a file ".bashrs." (without extention) and save. windows will save it as ".bashrc"
alias ls='ls -alh'
alias cdnginx='cd /c/nginx && ls'
alias cdmcga='cd /c/Users/[user]/sbox/node/mcga && ls'
alias cdfood9='cd /c/Users/[user]/sbox/node/food9 && ls'
alias cdmysql='cd /c/nginx/mysql/bin && ls'
alias cdsbox='cd /c/Users/[user]/sbox && ls'
alias cdangular='cd /c/Users/[user]/sbox/angularjs && ls'
alias cdmongobin='cd "/c/Program Files/MongoDB/Server/3.0/bin" && ls'
alias cdmongodata='cd /c/mongodb/data/db && ls'
alias sbrc='cd ~ && source .bashrc'
alias mydocs='cd ~/Documents'
@davidgjordan
Copy link

Great thanks!!

@digitalev2000
Copy link

Go to: C:\Users\ [youruserdirectory] \bash_profile
In your bash_profile file type -
alias desk='cd " [DIRECTORY LOCATION] "'
Refresh your User directory where the bash_profile file exists then reopen your CMD or Git Bash window
Type in desk to see if you get to the Desktop location or the location you want in the "DIRECTORY LOCATION" area above

@digitalev2000
Copy link

Note: [ desk ] can be what ever name that you choose and should get you to the location you want to get to when typed in the CMD window.

@MeiRct
Copy link

MeiRct commented Jan 11, 2018

It's better to change alias sbrc='cd ~ && source .bashrc' to alias sbrc='source ~/.bashrc', for not leaving the current directory.

@peacefulseeker
Copy link

Great. Thanks!

Copy link

ghost commented Jul 26, 2018

in git home directory, in etc directory , this is a bash.bashrc file, you can also append this file, to set alias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment