• Fushuan [he/him]@lemm.ee
    link
    fedilink
    arrow-up
    20
    ·
    2 days ago

    Put this in bashrc or whatever flavour of shells’s bashrc you use:

    function cs () { cd “$@” && ls }

    I didnt remember the function sintax of bash so I just copied it from SO.

    • Artyom@lemm.ee
      link
      fedilink
      arrow-up
      18
      ·
      2 days ago
      cs () {
          cd $1;
          ls ${@:2}
      }
      

      You (probably) only want to pass the first argument to cd, this’ll send the rest to ls.

      • ka1ikasan@lemmy.zip
        link
        fedilink
        arrow-up
        5
        ·
        2 days ago

        Did that years ago, just called it cds. I also have an “up” command which is an alias to “cds …”. Oh, and I have a “setup server_name” they copy all my aliases to a server and create an alias that allow me to “ssh -A server_name” using only server_name.