以安装了zsh为例,其中通过在 ~/.zshrc 追加 alias,减少常用指令的时间时间开销 ,"shift + g"跳到文件最后一行
#git
alias ga="git add"
alias gl="git log"
alias gt="git status"
alias gc="git commit"
alias gco="git checkout"
alias gcb="git checkout -b"
alias gp="git push"
alias gpl="git pull"
alias gd="git diff"
alias gb="git branch"
alias gst="git status"
alias gg="git add . && git commit -m 'feat: auto commit' && git push"
2.nodejs
alias n10="nvm use 10.22.0"
alias dev="npm run dev"
alias debug="npm run debug"
3.common
alias czsh="vi ~/.zshrc"
alias szsh="source ~/.zshrc"
alias la='ls -a'
alias lla='ls -al'
alias showip="ifconfig | grep inet | grep -v inet6"
alias mkdir="mkdir -p"
alias nginx='/usr/local/nginx/sbin/nginx'
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
alias t="trans"
export PATH="/usr/local/sbin:$PATH"
export JAVA_6_HOME=/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
export JAVA_7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
alias jdk6="export JAVA_HOME=$JAVA_6_HOME" #编辑一个命令jdk6,输入则转至jdk1.6
alias jdk7="export JAVA_HOME=$JAVA_7_HOME" #编辑一个命令jdk8,输入则转至jdk1.8
alias jdk8="export JAVA_HOME=$JAVA_8_HOME" #编辑一个命令jdk8,输入则转至jdk1.8
export JAVA_HOME=`/usr/libexec/java_home` #最后安装的版本,这样当自动更新时,始终指向最新版本