Settings

Theme

Bash Keyboard Shortcuts Stickers

cmd.club

48 points by flipstewart 11 years ago · 26 comments

Reader

nausher81 11 years ago

If anyone is wondering what the list of shortcuts are -

  ^ is Ctrl    
  Alt is the alt/option key

  Alt+F/B - Forward/Backward Word
  ^P - Prev command
  ^N - Next command
  ^XX - Toggle between beginning of line & current  cursor positions
  Alt+F/B - Forward/Backward Word
  Alt+T/Esc+T  - Swap current word with prev
  ^L - Clear screen
  ^H/^D - Backspace / Forward Delete Character
  ^W - Delete/Cut word before cursor
  ^K - Delete/Cut till End of Line
  ^U - Delete/Cut Line Before cursor
  ^Y - Paste last cut
  Alt+U/L - UPPER/lower case word after cursor
  ^- - Undo
  ^Z - Stop the current process and send it to the background.

I don't know what these do - Alt R - ^C -
  • klibertp 11 years ago

    > ^XX - Toggle between beginning of line & current cursor positions

    This is not true. ^X^X is actually a well known for Emacs users command "exchange-point-and-mark" and it only skips to the beginning of line because that's where the mark is by default. You can set the mark yourself with C-<space> anywhere on the line. From this point on pressing ^X^X will move your cursor to where you activated the mark, and move the mark to where your cursor was. That's pretty useful sometimes.

    These two should be equivalent, I think, unless there is something strange going on:

        Alt+T - Swap current word with prev
        Esc+T Swap last 2 words with prev
    
    C-c abandons current line without saving it in the kill ring and no matter where on the line you are. Faster than C-e C-u or C-a C-k.

    M-r (Alt R) works as if you pressed undo (C-/ or C-_) enough times to get back to the empty line.

    I put a little cheatsheet for those things some time ago for my coworkers, it lives here: http://klibert.pl/readline.html

miah_ 11 years ago

This should be called 'Readline keyboard shortcuts'. Because they are all handled by Readline and have nothing to do with Bash and are already supported by anything that also links to Readline.

  • klibertp 11 years ago

    To be fair bash and readline were/are very closely related in terms of codebases. But it's true that almost all command line interactive apps which don't use curses use readline, which makes those keyboard shortcuts worth knowing.

bitslayer 11 years ago

What is the shortcut for set -o vi ?

  • flipstewartOP 11 years ago

    ;)

    On OS X, these shortcuts work in generic text inputs as well! That's enough of a reason to convince me to keep the default shortcuts.

daveloyall 11 years ago

> Whether you’ve just opened Terminal for the first time or you’re a seasoned iTerm user

Seasoned iTerm user? First off, what the heck is an iTerm? Oh, it's an open source Terminal.app replacement first released in 2002. http://iterm.sourceforge.net/history.shtml

Seasoned indeed! :)

berodam 11 years ago

Looks cool, but I'm afraid it would not work very well on my ThinkPad

  • flipstewartOP 11 years ago

    You're right, it won't :/

    These are made very specifically for MacBooks, but I'm thinking of making a more generic option soon!

    • wyclif 11 years ago

      How about a version for zsh? Nothing against bash, that's what I used for over a decade, but many of us have moved on to zsh.

      • flipstewartOP 11 years ago

        There are some slight discrepancies, but the majority of the shortcuts work the same in zsh!

    • stuaxo 11 years ago

      Yeah, pc version please :)

discreditable 11 years ago

Is there a normal keyboard listing of these? The keys are obscured in the photos.

mitosis 11 years ago

I think control-L should be "^L", not "^+L", and so on.

koesterd 11 years ago

Unfortunately only available in the US and Canada.

unixengineer 11 years ago

zsh too please

  • elektronjunge 11 years ago

    They are basically the same. In fact these short-cuts work for most things that use readline, e.g. psql, irb, bash, zsh, etc.

maerF0x0 11 years ago

promo code?

igl 11 years ago

Unfortunately only available with Fisher-Price key labels.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection