Bash - Shortcut Key Character Sequence (keyseq)

About

This section describes just the value (keyseq) content used in the shortcut configuration through:

  • binding with the bind function
  • or the shortcut configuration file .inputrc

Basis

Sequence Description Describe the character produced when
C-k Control-K the k key is pressed while the Control key is depressed.
M-k Meta-K with Alt The Meta key (ALT) is depressed, and the k key is pressed. On keyboards with two keys labeled ALT (usually to either side of the space bar), the ALT on the left side is generally set to work as a Meta key.
M-k Meta-K without Alt Metafying the k key - ESC first, and then typing k.
M-C-k Meta-Control-k metafying C-k

Several keys have their own names. Specifically:

  • DEL (delete)
  • ESC (escape)
  • LFD (linefeed). (If the keyboard lacks a LFD key (line feed), typing C-j will produce the desired character)
  • SPC (??),
  • RET (Return), (The RET key may be labeled Return or Enter on some keyboards)
  • TAB (Tabulation)

They all stand for themselves when seen in a text, or in an init file.

Management

Get

You can determine the character sequence emitted by a key by pressing Ctrl-v at the command line, then pressing the key you're interested in.

Example

  • \e[5~ = Page Up
  • \e[6~ = Page Down
  • \e[A = Arrow Up
  • \e[B = Arrow Down
  • \e[C = Arrow Right
  • \e[C = Arrow Left
  • \e[3~ = Delete
  • \e[H = Home
  • \e[F = End
  • \e (escape) is interpreted as the META character (Alt) or as the Metafying key (ie ESCAPE character). See Bash - Character
  • \C is interpreted as the Control character (Ctrl)
  • \eb is ALT+b

Documentation / Reference


Powered by ComboStrap