• lonnez
    link
    fedilink
    arrow-up
    3
    ·
    3 years ago

    Seeing your up alias reminded me of a bash function I setup a while ago also called up. I use it to simulate doing cd .. n number of times. e.g. up 5 would go up 5 directory levels.

    up ()
    {
        local levels;
        local i;
        [[ -z "$1" ]] && levels=1 || levels="$1";
        for ((i=0; i<levels; i++))
        do
            cd ../;
        done
    }
    

    It’s probably the smallest, yet most convenient thing I’ve setup on my machines. Especially so if you work in languages with lots of nested subdirectories (like Java).

    • Jakob :lemmy:@lemmy.schuerz.at
      link
      fedilink
      arrow-up
      0
      arrow-down
      1
      ·
      edit-2
      3 years ago

      i setup several aliases

      alias ..='cd ..'
      alias ...='cd ../../.'
      alias ...='cd ../../../.'
      alias ....='cd ../../../../.'
      

      and so on…