Terminal & Shell Shortcuts Cheat Sheet
Master terminal productivity with essential Bash, Zsh, and terminal emulator shortcuts. Navigation, history, job control, and Tmux included.
Why Learn Terminal Shortcuts?
The command line is the backbone of software development. Whether you are running builds, managing Git repos, SSHing into servers, or scripting automation, speed at the terminal translates directly into productivity. Most developers know a handful of terminal shortcuts, but there are dozens more that can save you significant time every day.
This guide covers shortcuts for Bash/Zsh, common terminal emulators (macOS Terminal, iTerm2, Windows Terminal), and Tmux.
---
Readline Shortcuts (Bash & Zsh)
These shortcuts work in any shell that uses GNU Readline, which includes Bash and Zsh by default. They are the foundation of terminal efficiency.
Cursor Movement
| Shortcut | Action |
|---|---|
Ctrl + A | Move to beginning of line |
Ctrl + E | Move to end of line |
Ctrl + F | Move forward one character |
Ctrl + B | Move backward one character |
Option + F (or Alt + F) | Move forward one word |
Option + B (or Alt + B) | Move backward one word |
Ctrl + XX | Toggle between current position and beginning of line |
Editing
| Shortcut | Action |
|---|---|
Ctrl + D | Delete character under cursor (or logout if line empty) |
Ctrl + H | Delete character before cursor (backspace) |
Ctrl + W | Delete word before cursor |
Option + D (or Alt + D) | Delete word after cursor |
Ctrl + K | Delete from cursor to end of line |
Ctrl + U | Delete from cursor to beginning of line |
Ctrl + Y | Paste last deleted text (yank) |
Ctrl + T | Transpose (swap) two characters |
Option + T (or Alt + T) | Transpose two words |
Ctrl + _ | Undo last edit |
Line Control
| Shortcut | Action |
|---|---|
Ctrl + L | Clear screen (same as clear) |
Ctrl + C | Cancel current command |
Ctrl + D | Exit shell (when line is empty) |
Ctrl + Z | Suspend current process (send to background) |
Ctrl + J | Same as Enter (execute command) |
Ctrl + M | Same as Enter |
---
Command History
History navigation is one of the biggest time-savers in the terminal.
| Shortcut | Action |
|---|---|
Up Arrow or Ctrl + P | Previous command in history |
Down Arrow or Ctrl + N | Next command in history |
Ctrl + R | Reverse search through history |
Ctrl + S | Forward search through history |
Ctrl + G | Cancel history search |
!! | Repeat last command |
!n | Repeat command number n |
!string | Repeat last command starting with string |
!$ | Last argument of previous command |
!* | All arguments of previous command |
^old^new | Quick substitution in last command |
History Tips
- Ctrl + R is the single most powerful history shortcut. Press it, start typing, and it will find the most recent matching command. Press Ctrl + R again to cycle through older matches.
- In Zsh with fzf, history search becomes even more powerful with fuzzy matching. Install fzf and add it to your shell config for a massive productivity boost.
- Run
history | grep keywordto search your full command history.
---
macOS Terminal Shortcuts
| Shortcut | Action |
|---|---|
Cmd + T | New tab |
Cmd + N | New window |
Cmd + W | Close tab |
Cmd + Shift + [ / ] | Switch between tabs |
Cmd + + / Cmd + - | Increase / decrease font size |
Cmd + K | Clear scrollback |
Cmd + , | Open preferences |
---
iTerm2 Shortcuts (macOS)
iTerm2 is the most popular terminal emulator for Mac. It has many additional shortcuts beyond the default Terminal.
| Shortcut | Action |
|---|---|
Cmd + D | Split pane vertically |
Cmd + Shift + D | Split pane horizontally |
Cmd + Option + Arrow | Navigate between panes |
Cmd + ] / Cmd + [ | Next / previous pane |
Cmd + Shift + Enter | Toggle maximize pane |
Cmd + T | New tab |
Cmd + Number | Switch to tab by number |
Cmd + F | Find |
Cmd + Shift + H | Paste history |
Cmd + ; | Autocomplete |
Cmd + Shift + I | Broadcast input to all panes |
Cmd + Option + B | Instant Replay |
Cmd + Click | Open file/URL under cursor |
---
Windows Terminal Shortcuts
| Shortcut | Action |
|---|---|
Ctrl + Shift + T | New tab |
Ctrl + Shift + W | Close tab/pane |
Ctrl + Tab | Switch tabs |
Alt + Shift + D | Duplicate pane |
Alt + Shift + + | Split pane vertically |
Alt + Shift + - | Split pane horizontally |
Alt + Arrow | Navigate between panes |
Ctrl + Shift + F | Find |
Ctrl + + / Ctrl + - | Zoom in / out |
Ctrl + Shift + P | Command palette |
---
Tmux Shortcuts
Tmux is a terminal multiplexer that lets you create sessions, windows, and panes. The default prefix key is Ctrl + B.
Sessions
| Shortcut | Action |
|---|---|
tmux new -s name | Create named session |
Prefix + d | Detach from session |
tmux ls | List sessions |
tmux attach -t name | Attach to session |
Prefix + $ | Rename session |
Prefix + s | Switch between sessions |
Windows
| Shortcut | Action |
|---|---|
Prefix + c | Create new window |
Prefix + n | Next window |
Prefix + p | Previous window |
Prefix + number | Switch to window by number |
Prefix + , | Rename window |
Prefix + & | Close window |
Prefix + w | List windows |
Panes
| Shortcut | Action |
|---|---|
Prefix + % | Split vertically |
Prefix + " | Split horizontally |
Prefix + Arrow | Navigate panes |
Prefix + x | Close pane |
Prefix + z | Toggle pane zoom (fullscreen) |
Prefix + { / } | Swap pane position |
Prefix + Space | Cycle pane layouts |
Prefix + q | Show pane numbers |
Copy Mode (Tmux)
| Shortcut | Action |
|---|---|
Prefix + [ | Enter copy mode |
q | Exit copy mode |
Space | Start selection |
Enter | Copy selection |
Prefix + ] | Paste |
---
Useful Shell Aliases and Functions
Beyond shortcuts, aliases can speed up common tasks:
`bash
# Navigation
alias ..="cd .."
alias ...="cd ../.."
alias ll="ls -la"
# Git
alias gs="git status"
alias gc="git commit"
alias gp="git push"
alias gl="git log --oneline -20"
# Quick edit
alias zshrc="$EDITOR ~/.zshrc"
alias bashrc="$EDITOR ~/.bashrc"
# Safety
alias rm="rm -i"
alias cp="cp -i"
alias mv="mv -i"
`
---
Top 10 Terminal Shortcuts Everyone Should Know
- Ctrl + R — Reverse history search. Finds any command you have run before.
- Ctrl + A / Ctrl + E — Jump to start/end of the line.
- Ctrl + W — Delete the word before the cursor.
- Ctrl + K — Delete everything after the cursor.
- Ctrl + U — Delete everything before the cursor.
- Ctrl + L — Clear the screen.
- Ctrl + C — Cancel the current command.
- Ctrl + Z — Suspend the current process (resume with
fg). - !! — Repeat the last command (
sudo !!is a classic). - Ctrl + D — Exit the shell.
---
Building Terminal Muscle Memory
Terminal shortcuts are especially hard to learn because they are not visible — there are no menus or toolbars to remind you. Here is how to make them stick:
- Start with Ctrl + R. It is the single highest-impact shortcut.
- Print this cheat sheet and keep it next to your keyboard.
- Use a shortcut trainer like Keyhab to practice daily with spaced repetition.
- Customize your shell. Add aliases and functions for your most common workflows.
---
Conclusion
Terminal efficiency is a compounding investment. The shortcuts in this guide will save you seconds on each command, which adds up to hours over weeks and months. Start with the top 10, practice consistently, and gradually expand your repertoire to include Tmux and terminal emulator shortcuts.