Last active
January 1, 2016 17:19
-
-
Save manhg/8176672 to your computer and use it in GitHub Desktop.
A ~/.bash_profile in MacOS for developer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export JAVAPATH="/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/java/bin" | |
export PATH="/usr/local/sbin:/usr/local/opt/coreutils/libexec/gnubin:$JAVAPATH:/usr/bin:$PATH" | |
export MANPATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnuman" | |
export EDITOR="nano" | |
export SVN_EDITOR="nano" | |
export PS1="\u@\w$ " | |
set completion-ignore-case On | |
alias ..='cd ..' | |
alias ...='cd ../../../' | |
alias .3='cd ../../../' # Go back 3 directory levels | |
alias .4='cd ../../../../' # Go back 4 directory levels | |
alias .5='cd ../../../../../' # Go back 5 directory levels | |
alias .6='cd ../../../../../../' # Go back 6 directory levels | |
alias dt='tee ~/Desktop/terminal.txt' | |
alias glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative" | |
alias gst='git status' | |
alias gc='git commit -a' | |
alias gsu='git svn rebase' | |
alias gsc='git svn dcommit' | |
alias gsr='git rebase --continue' | |
alias gexp='git archive master --format zip > $(date +"%y-%m-%d").zip' | |
alias gscp='gsc;git push' | |
alias wget='wget --trust-server-names --no-check-certificate ' | |
# alias zip='zip -r -x *.DS_Store -x *.git* -x *.svn* ' | |
alias dsclean='find . -type f -name .DS_Store -print0 | xargs -0 rm' | |
# Flush your dns cache | |
alias dnsflush='dscacheutil -flushcache' | |
alias fh='open -a Finder .' | |
alias du1='du -h --max-depth=1' | |
## Colorize the ls output ## | |
alias ls='ls --color=auto -h' | |
alias ll='ls -la' | |
alias l.='ls -d .* --color=auto' | |
alias grepc='grep --color=always -ni' | |
alias grepphp="grep --color=always -ni -r --include=*.php " | |
alias egrep='egrep --color=auto' | |
alias mount='mount |column -t' | |
# handy short cuts # | |
alias h='history' | |
alias j='jobs -l' | |
alias ports='netstat -tulanp' | |
# get web server headers # | |
alias header='curl -I' | |
# become root # | |
alias root='sudo -i' | |
alias su='sudo -i' | |
extract () { | |
if [ -f $1 ] ; then | |
case $1 in | |
*.tar.bz2) tar xjf $1 ;; | |
*.tar.gz) tar xzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar e $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xf $1 ;; | |
*.tbz2) tar xjf $1 ;; | |
*.tgz) tar xzf $1 ;; | |
*.zip) unzip $1 ;; | |
*) echo "'$1' cannot be extracted via extract()" ;; | |
esac | |
else | |
echo "'$1' is not a valid file" | |
fi | |
} | |
alias qfind="find . -name " # qfind: Quickly search for file | |
ff () { /usr/bin/find . -name "$@" ; } # ff: Find file under the current directory | |
ffs () { /usr/bin/find . -name "$@"'*' ; } # ffs: Find file whose name starts with a given string | |
ffe () { /usr/bin/find . -name '*'"$@" ; } # ffe: Find file whose name ends with a given string | |
alias ttop="top -R -F -s 10 -o rsize" | |
alias lsock='sudo /usr/sbin/lsof -i -P' # lsock: Display open sockets | |
alias open-ports='sudo lsof -i | grep LISTEN' # openPorts: All listening connections | |
alias show-blocked='sudo ipfw list' # showBlocked: All ipfw rules inc/ blocked IPs6 | |
# Generate random password | |
alias mkpass='dd if=/dev/urandom count=1 2> /dev/null | uuencode -m – | sed -ne 2p | cut -c -10' | |
alias fix-chmod='find . -type d -exec chmod 755 {} \;find . -type f -exec chmod 644 {} \;' | |
# Encoding | |
alias encode-shiftjis='iconv -c -f UTF-8 -t SHIFT-JIS ' # Convert to ShiftJIS | |
alias encode-utf8='iconv -c -t UTF-8 -f SHIFT-JIS ' # Convert to UTF-8 | |
alias http-restart='sudo apachectl restart'export PYTHONSTARTUP=~/.pythonrc | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
alias codecept='/Volumes/Dev/_tools/codecept.phar' | |
export PYTHONSTARTUP=~/.pythonrc | |
export PYTHONIOENCODING=utf-8 | |
alias py='python3 -u ' | |
alias py3='python3' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment