I accidentally discovered that both “cd …” and “…” work, and moreover, I can add more dots to go back further! I’m using zsh on iTerm2 on macOS. I’m pretty sure this isn’t a cd feature. Is this specific to zsh or iTerm2? Are there other cool features I just never knew existed??

I’m so excited about an extra dot right now.

  • thelastknowngod@lemm.ee
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    8 months ago

    I have a function called up. I do up X where X is the number of directories I want to go up.

    up() {
      if [[ $# -eq 0 ]]; then
        cd ..
        return 0
      fi
      local path i
      for (( i=0; i < $1; i++ )); do
        path+=../
      done
      cd "$path"
    }
    

    EDIT: Don’t know if it’s just me but if you see < it should be the less than character.