Linux: Bash Keys
This pages show the bash keybinding, man page keys, and terminal keys.
Bash Keys
Moving cursor:
- Ctrl+b = backward a character
- Ctrl+f = forward a character
- Alt+b = backward word. Or Ctrl+←
- Alt+f = forward word. Or Ctrl+→
- Ctrl+a = move to beginning of line
- Ctrl+e = move to end of line
Deleting:
- Ctrl+h = delete backward 1 char
- Ctrl+d = delete forward 1 char
- Alt+Backspace ⌫ = delete word backward
- Alt+d = delete word forward
- Ctrl+u = delete to beginning of line
- Ctrl+k = delete to end of line
Paste:
- Ctrl+y = paste. (deleted word or line can be pasted)
Search Command History:
- Ctrl+r = interactive search backward command history. (can press it multiple times)
- Ctrl+s = search forward command history
- Ctrl+c = exit search
- Escape = exit search with current choice
- ↑ = previous command
- ↓ = next command (after you pressed ↑)
Bash keys are a subset of emacs keys.
〔see Emacs Keys Basics〕
Special, Job Control:
- Ctrl+l = clear screen (must be first input to prompt)
- Ctrl+d = exit shell (must be first input to prompt)
- Ctrl+c = terminate current foreground process (SIGINT)
- Ctrl+z = suspend current foreground process (SIGTSTP)
〔see Linux: Job Control〕
You can see most of special process control keys by stty -a
.
〔see Linux: Terminal Control Sequence Keys〕