有时候需要用alias做几个简单好记的命令方便快速输入

可以使用alias进行修改别名

在我的Ubuntu系统下 看一下 /etc/bash.bashrc 文件 在后面加入这个代码

# add the alias command
if [ -f /etc/aliasbashrc ]; then
    . /etc/aliasbashrc
fi

检测到 /etc/aliasbashrc 这个后就执行它让它能专门用来写别名alias

cat /etc/aliasbashrc

可以看到

alias gts="git status"
alias gct="git checkout"
alias gdf="git diff"
alias gad="git add"
alias grm="git rm"
alias gcm="git commit -m"
alias gft="git fetch"
alias grb="git rebase"
alias gph="git push"

保存 写入 source ~/.profile 导入一下。

然后命令行就可以使用 gts 代替 git status了 其他命令也一样。

相关文章:

  • 2021-09-12
  • 2021-10-22
  • 2022-01-18
  • 2021-12-13
  • 2021-09-07
  • 2021-05-25
  • 2021-06-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
相关资源
相似解决方案