Linux: 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
- Esc
- exit search with current choice
- ↑
- previous command
- ↓
- next command (after you pressed ↑)
Bash keys are a subset of emacs keys. [see Emacs Keys Basics]
Exit Shell
- Ctrl+d
- exit shell (must be first input to prompt)
Job Control Keys
- Ctrl+c
- terminate current foreground process (SIGINT)
- Ctrl+z
- suspend current foreground process (SIGTSTP)
Terminal Control Sequence Keys
- Ctrl+l
- clear screen (must be first input to prompt)