Linux: Bash/Terminal 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]
Man Page Keys
Terminal App Keys
Here's most important keys in Gnome terminal. (You can see the full list under menu [Edit ▸ Keyboard Shortcuts…])
- Ctrl+Shift+c = copy.
- Ctrl+Shift+v = paste.
- Shift+PageUp = page up the terminal screen. Mouse scroll wheel works too.
- Shift+PageDown = page down the terminal screen.
- Shift+Home = move to top of the terminal screen.
- Shift+End = move to bottom of the terminal screen.
- Ctrl+PageUp = Previous tab. (same as Firefox.)
- Ctrl+PageDown = Next tab.
- Alt+1 = switch to tab 1. (same as Firefox.)
- Alt+2 = switch to tab 2.
- Ctrl+Shift+t = new tab.
- Ctrl+Shift+w = close tab.
System-Wide Virtual Console Keys
- Ctrl+Alt+F1 Switch entire screen to virtual console 1. F1 can be up to F6.
- Ctrl+Alt+F7 Switch entire screen back to GUI mode.