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

路径探索 cd/pwd/which

  • cd 路径切换

    • 相对切换
      • cd xxxcd ./xxx 进入当前目录下的xxx文件夹
      • cd .. 返回上一级目录
        • cd ../yy 进入上一级目录下的yy文件夹
    • 绝对切换
      • cd / 返回根目录
        • cd /etc 进入根目录下etc文件夹
        • cd /etc/nginx 进入etc下的nginx文件夹
    • 回归
      • cdcd ~ 返回目前登录的用户目录
        • 一般在 根目录/home 下面 某个文件夹
        • 也有可能在 根目录/Users 下面
      • cd - 返回上一次操作的目录
  • pwd

    • 展示当前所在绝对路径
  • which xxx

    • 显示某个软件指令的绝对路径
    • 会在 环境变量 $PATH 设置的目录下 查找
      • 比如which bash/which ruby/which pgsql