Knowing keyboard shortcuts for the Linux terminal saves hours of repetitive typing. These shortcuts work in Bash (the default shell on most Linux distributions), and most also work in Zsh and other shells that use the GNU Readline library. This reference covers cursor movement, text editing, history search, process control, and terminal management.
Cursor Movement Shortcuts
Move the cursor without reaching for the arrow keys.
| Shortcut | Action |
|---|---|
Ctrl + A | Move cursor to the beginning of the line |
Ctrl + E | Move cursor to the end of the line |
Ctrl + F | Move cursor one character forward (same as Right arrow) |
Ctrl + B | Move cursor one character backward (same as Left arrow) |
Alt + F | Move cursor one word forward |
Alt + B | Move cursor one word backward |
Ctrl + XX | Toggle between the start of the line and current cursor position |
Text Editing Shortcuts
Delete, cut, and paste text directly on the command line without a mouse.
| Shortcut | Action |
|---|---|
Ctrl + U | Cut everything from the cursor to the beginning of the line |
Ctrl + K | Cut everything from the cursor to the end of the line |
Ctrl + W | Cut the word before the cursor |
Alt + D | Cut the word after the cursor |
Ctrl + Y | Paste the last cut text (yank) |
Alt + Y | Cycle through previously cut text (after Ctrl + Y) |
Ctrl + D | Delete the character under the cursor (or logout if line is empty) |
Ctrl + H | Delete the character before the cursor (same as Backspace) |
Alt + T | Swap the current word with the previous word |
Ctrl + T | Swap the character under the cursor with the previous one |
Alt + U | Uppercase the word from the cursor to the end of the word |
Alt + L | Lowercase the word from the cursor to the end of the word |
Alt + C | Capitalize the character under the cursor and move to end of word |
Command History Shortcuts
Search and reuse previously executed commands.
| Shortcut | Action |
|---|---|
Ctrl + R | Reverse search through command history (type to filter) |
Ctrl + G | Cancel the reverse search and restore original line |
Ctrl + P | Previous command in history (same as Up arrow) |
Ctrl + N | Next command in history (same as Down arrow) |
Alt + . | Insert the last argument from the previous command |
!! | Repeat the last command (useful with sudo: sudo !!) |
!$ | Refer to the last argument of the previous command |
!* | Refer to all arguments of the previous command |
!abc | Run the most recent command starting with “abc” |
!abc:p | Print the most recent command starting with “abc” without running it |
^old^new | Run the previous command but replace “old” with “new” |
Process Control Shortcuts
Manage running processes and signals from the terminal.
| Shortcut | Action |
|---|---|
Ctrl + C | Send SIGINT – interrupt and stop the current foreground process |
Ctrl + Z | Send SIGTSTP – suspend the current process (resume with fg or bg) |
Ctrl + D | Send EOF – logout of the current shell session (same as exit) |
Ctrl + \ | Send SIGQUIT – terminate the process and dump core |
Ctrl + S | Freeze terminal output (stop scrolling) |
Ctrl + Q | Resume terminal output (unfreeze after Ctrl + S) |
Terminal and Screen Shortcuts
| Shortcut | Action |
|---|---|
Ctrl + L | Clear the terminal screen (same as the clear command) |
Tab | Auto-complete file names, commands, and paths |
Tab Tab | Show all possible completions when there are multiple matches |
Ctrl + _ | Undo the last editing action |
Alt + R | Revert all changes to the current line |
Bang (!) History Expansion Examples
History expansion with ! is one of the most powerful time-saving features in Bash. Here are practical examples.
Rerun the last command as root:
sudo !!
Use the last argument from the previous command. If you ran mkdir /var/www/mysite, you can immediately cd into it:
cd !$
Quick substitution – fix a typo in the previous command without retyping the whole thing:
^teh^the
Run the most recent ssh command from history:
!ssh
Customize Readline Key Bindings
All Bash shortcuts are controlled by the GNU Readline library. You can view and customize bindings using the bind command or the ~/.inputrc file.
List all current key bindings:
bind -P | grep -v "not bound"
Enable case-insensitive tab completion by adding this to ~/.inputrc:
set completion-ignore-case On
Show all completions immediately without pressing Tab twice:
set show-all-if-ambiguous On
Conclusion
These shortcuts work across virtually all Linux terminals and most SSH sessions. The most impactful ones to learn first are Ctrl + R for history search, Ctrl + A / Ctrl + E for line navigation, and Ctrl + U / Ctrl + K for cutting text. For multiplexed terminal sessions with additional shortcuts, look into tmux.
Related guides:
- How to install and configure Zsh on Linux
- How To Install and Use Tmux on Linux
- Configure Zsh syntax highlighting on Linux / macOS
- Top 20 Windows PowerShell Keyboard Shortcuts For Geeks
- Kubectl Cheat Sheet for Kubernetes Admins and CKA Exam Prep























































