Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

设置别名 type/alias

  • type 显示命令类型

    • type ls 会输出 It is aliased to 'ls --color=tty'
    • type foofoo: not found,代表可以用来设置别名
  • alias 给 冗长指令 设置 短别名

    • alias foo='cd /usr; ls; cd -'
      • 冗长指令 需要写在''之间,并放在=右边
      • 短别名 放在=左边
    • unalias foo 可以删除别名
    • alias 直接查看系统中已有的所有别名
    • 注意
      • 在结束会话时,这个别名设置会消失
      • 如果不想消失,就要把命令写入系统环境的初始化文件中,使得进入终端会话时,自动加载执行