• @lonnez
    link
    32 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:
      link
      fedilink
      -1
      edit-2
      2 years ago

      i setup several aliases

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

      and so on…

  • Tmpod
    link
    fedilink
    12 years ago

    Yup, aliases are super useful! One of my most used ones is mkcd; you almost always want to cd into a dir after you make it.

    I also like fish’s abbreviations (created through abbr), which are essentially aliases that get expanded when you run them. For example, if I set an abbreviation with abbr -a dkc docker-compose, I can then just type dkc and it will expand it to the full command when I either hit enter or space.

  • ghost_laptop
    link
    12 years ago

    Are you creating a copy of your commands in some /bin folder and renaming?

    • @lonnez
      link
      32 years ago

      Probably just bash aliases:

      e.g.

      alias in="apt install"
      
      • SudoDnfDashYOP
        link
        22 years ago

        You’re right.

        alias in=“sudo apt install”

        alias up=“sudo apt update && sudo apt upgrade”

        alias unin=“sudo apt purge”

        I just put this all in my .bashrc file.