Keyword: alias
Example:
alias pull = 'git pull origin'
alias push = 'git push origin'
alias add = 'git add .'
alias commit = 'git commit -m'
alias checkout = 'git checkout'
alias status = 'git status'
-----------------------------------------
alias demo='cd /xxx/xxx/xxx && python demo.py'
将所有的alias 的命令保存于 ~/.bashrc文件(没有则创建此文件),然后输入:
source ~/.bashrc
在此之前,保证有 ~/.bash_profile 文件(没有则创建此文件),在其中加入一行
source ~/.bashrc
~/.bash_profile
是终端每次启动时自动执行的文件
当你使用了zsh时,设置自动加载.bash_profile的方法如下:
sudo vim ~/.zsh
在最后面添加一行代码
source ~/.bash_profile
这样重启terminal时就能自动加载.bash_profile文件了。
网友评论