• @lonnez
    33 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++))
            cd ../;

    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:
      3 years ago

      i setup several aliases

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

      and so on…

  • Tmpod
    13 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
    13 years ago

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

    • @lonnez
      33 years ago

      Probably just bash aliases:


      alias in="apt install"
      • SudoDnfDashYOP
        23 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.