I thought it’d be a pain but installing programs through the terminal is actually so nice, I never would have expected it

  • kibiz0r@midwest.social
    link
    fedilink
    English
    arrow-up
    40
    ·
    2 months ago
    • tab completion works in more places than you might expect
    • ctrl-a/ctrl-e for start/end of line
    • ctrl-u to clear the command you’ve typed so far but store it into a temporary pastebuffer
    • ctrl-y to paste the ctrl-u’d command
    • ctrl-w to delete by word (I prefer binding to alt-backspace though)
    • ctrl-r to search your command history
    • alt-b/alt-f to move cursor back/forwards by word
    • !! is shorthand for the previous run command; handy for sudo !!
    • !$ is the last argument of the previous command; useful more often than you’d think
    • which foo tells you where the foo program is located
    • ls -la
    • cd without any args takes you to your home dir
    • cd - takes you to your previous dir
    • ~ is a shorthand for your home dir
    • myotheraccount@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      2 months ago
      • alt-. also pastes the last argument of the previous command (useful if you need to modify it a bit)
      • instead of any shortcuts starting with “alt” you can also press “esc” followed by the second key, e.g. pressing “esc”, releasing it and then “a” is the same as pressing “alt-a” (useful if you have only one hand available, or if alt is not availalble)
      • if you put a space before a command, it will not be saved in history (useful sometimes, e.g. if you pass a password directly as an argument)
      • Dumhuvud@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 months ago

        I believe, these are Emacs shortcuts. There’s also set -o vi in bash, but I’ve never used it, so can’t vouch for it.

        • apelsin12@lemm.ee
          link
          fedilink
          arrow-up
          2
          ·
          2 months ago

          Explains why they are so illogical! Unfortunately i think its better to just learn the defaults since i remote into lots of servers where i dont carry my config

    • Dumhuvud@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 months ago

      Nice list, TIL about Ctrl+U and Ctrl+Y.

      If I may add, Ctrl+X into Ctrl+E opens $EDITOR to edit the current line.

    • exocortex@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      2 months ago

      I’ve been using the commandline for so long but was always too lazy to look up the rest of these commands after ctrl+a/e and ctrl+r THANK YOU!!!

      post this commend again and again! There’s always lazy idiots like me who will be helped that way!