Skip to content

Instantly share code, notes, and snippets.

@biancapower
Last active January 30, 2020 22:33
Show Gist options
  • Save biancapower/e7e5ebeab94d69b19aa37e533cc6d11b to your computer and use it in GitHub Desktop.
Save biancapower/e7e5ebeab94d69b19aa37e533cc6d11b to your computer and use it in GitHub Desktop.

What is a bash profile?

  • configuration file for the bash shell
  • gets loaded when you load up the shell (open the terminal)
  • actual file depends on which shell you're using
    • .bash_profile and .bashrc if you're using bash
    • .zshrc if you're using zsh
  • check which shell you're in by running echo $SHELL in terminal

Customising Command Prompt

Aliases

# GIT
alias gs="git status"
alias gd="git diff"
alias gde="git diff --ignore-all-space --ignore-space-at-eol --ignore-space-change --ignore-blank-lines -- . ':(exclude)*package-lock.json'"
alias ga="git add"
alias ga.="git add ."
alias gc="git commit"
alias gcm="git commit -m"
alias gb="git branch"
alias gcb="git checkout -b"
alias gch="git checkout"
alias gp="git push"
alias gm="git merge"
alias gl="git log"

# OTHER

alias hidedesktop="defaults write com.apple.finder CreateDesktop false && killall Finder"

alias showdesktop="defaults write com.apple.finder CreateDesktop true && killall Finder"

alias coderacademy="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome https://coderacademy.instructure.com/courses/271/ https://mail.google.com/mail/u/1/#inbox https://calendar.google.com/calendar/b/1/r?tab=mc --new-window"

alias serve="python -m SimpleHTTPServer"

alias py="python3"

# add commit and push vimwiki from anywhere
alias vp="cd ~/vimwiki && git add . && git commit -m 'autosave' && git push && cd -"

# pull vimwiki from anywhere
alias vpl='cd ~/vimwiki && git pull && cd -'

# generic autosave
alias autosave="git add . && git commit -m 'autosave' && git push"

# do something different depending on OS (in this case, different colours when ls)

case $os in
    "Darwin" )
        alias ls='ls -GFh';;
    "Linux" )
        alias ls='ls --color=auto';;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment