Skip to content

Instantly share code, notes, and snippets.

@fosron
Last active October 2, 2017 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fosron/475fd6f8e9964e0deca198fb80e60a7d to your computer and use it in GitHub Desktop.
Save fosron/475fd6f8e9964e0deca198fb80e60a7d to your computer and use it in GitHub Desktop.
Various .bash_profile / .bash_rc additions for macOS and other Shell resources
# .bash_profile
# colors for shell
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# start aliases
# git commamands simplified
alias gst='git status'
alias gco='git checkout'
alias gci='git commit'
alias grb='git rebase'
alias gbr='git branch'
alias gad='git add -A'
alias gpl='git pull'
alias gpu='git push'
alias glg='git log --date-order --all --graph --format="%C(green)%h%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
alias glg2='git log --date-order --all --graph --name-status --format="%C(green)%H%Creset %C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset%s"'
# lock computer
alias lock='/System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend'
# simple ip
alias ip='ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d " " -f2'
# more details
alias ip1="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
# external ip
alias ip2="curl -s https://api.ipify.org/?format=text | awk '{print $1}'"
# grep with color
alias grep='grep --color=auto'
# refresh shell
alias reload='source ~/.bash_profile'
# up 'n' folders
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# ls in color
alias ls='ls -GFh'
# other shortcuts
alias sudo='sudo '
alias ll='ls -lh'
alias la='ls -lhA'
alias c='clear'
alias x='exit'
alias q='exit'
alias edit_hosts='edit /etc/hosts'
alias edit_profile='open -e ~/.bash_profile'
# end aliases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment