Keyhab
⌃R
Terminal

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

ShortcutAction
Ctrl + AMove to beginning of line
Ctrl + EMove to end of line
Ctrl + FMove forward one character
Ctrl + BMove backward one character
Option + F (or Alt + F)Move forward one word
Option + B (or Alt + B)Move backward one word
Ctrl + XXToggle between current position and beginning of line

Editing

ShortcutAction
Ctrl + DDelete character under cursor (or logout if line empty)
Ctrl + HDelete character before cursor (backspace)
Ctrl + WDelete word before cursor
Option + D (or Alt + D)Delete word after cursor
Ctrl + KDelete from cursor to end of line
Ctrl + UDelete from cursor to beginning of line
Ctrl + YPaste last deleted text (yank)
Ctrl + TTranspose (swap) two characters
Option + T (or Alt + T)Transpose two words
Ctrl + _Undo last edit

Line Control

ShortcutAction
Ctrl + LClear screen (same as clear)
Ctrl + CCancel current command
Ctrl + DExit shell (when line is empty)
Ctrl + ZSuspend current process (send to background)
Ctrl + JSame as Enter (execute command)
Ctrl + MSame as Enter

---

Command History

History navigation is one of the biggest time-savers in the terminal.

ShortcutAction
Up Arrow or Ctrl + PPrevious command in history
Down Arrow or Ctrl + NNext command in history
Ctrl + RReverse search through history
Ctrl + SForward search through history
Ctrl + GCancel history search
!!Repeat last command
!nRepeat command number n
!stringRepeat last command starting with string
!$Last argument of previous command
!*All arguments of previous command
^old^newQuick 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 keyword to search your full command history.

---

macOS Terminal Shortcuts

ShortcutAction
Cmd + TNew tab
Cmd + NNew window
Cmd + WClose tab
Cmd + Shift + [ / ]Switch between tabs
Cmd + + / Cmd + -Increase / decrease font size
Cmd + KClear 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.

ShortcutAction
Cmd + DSplit pane vertically
Cmd + Shift + DSplit pane horizontally
Cmd + Option + ArrowNavigate between panes
Cmd + ] / Cmd + [Next / previous pane
Cmd + Shift + EnterToggle maximize pane
Cmd + TNew tab
Cmd + NumberSwitch to tab by number
Cmd + FFind
Cmd + Shift + HPaste history
Cmd + ;Autocomplete
Cmd + Shift + IBroadcast input to all panes
Cmd + Option + BInstant Replay
Cmd + ClickOpen file/URL under cursor

---

Windows Terminal Shortcuts

ShortcutAction
Ctrl + Shift + TNew tab
Ctrl + Shift + WClose tab/pane
Ctrl + TabSwitch tabs
Alt + Shift + DDuplicate pane
Alt + Shift + +Split pane vertically
Alt + Shift + -Split pane horizontally
Alt + ArrowNavigate between panes
Ctrl + Shift + FFind
Ctrl + + / Ctrl + -Zoom in / out
Ctrl + Shift + PCommand palette

---

Tmux Shortcuts

Tmux is a terminal multiplexer that lets you create sessions, windows, and panes. The default prefix key is Ctrl + B.

Sessions

ShortcutAction
tmux new -s nameCreate named session
Prefix + dDetach from session
tmux lsList sessions
tmux attach -t nameAttach to session
Prefix + $Rename session
Prefix + sSwitch between sessions

Windows

ShortcutAction
Prefix + cCreate new window
Prefix + nNext window
Prefix + pPrevious window
Prefix + numberSwitch to window by number
Prefix + ,Rename window
Prefix + &Close window
Prefix + wList windows

Panes

ShortcutAction
Prefix + %Split vertically
Prefix + "Split horizontally
Prefix + ArrowNavigate panes
Prefix + xClose pane
Prefix + zToggle pane zoom (fullscreen)
Prefix + { / }Swap pane position
Prefix + SpaceCycle pane layouts
Prefix + qShow pane numbers

Copy Mode (Tmux)

ShortcutAction
Prefix + [Enter copy mode
qExit copy mode
SpaceStart selection
EnterCopy 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

  1. Ctrl + R — Reverse history search. Finds any command you have run before.
  2. Ctrl + A / Ctrl + E — Jump to start/end of the line.
  3. Ctrl + W — Delete the word before the cursor.
  4. Ctrl + K — Delete everything after the cursor.
  5. Ctrl + U — Delete everything before the cursor.
  6. Ctrl + L — Clear the screen.
  7. Ctrl + C — Cancel the current command.
  8. Ctrl + Z — Suspend the current process (resume with fg).
  9. !! — Repeat the last command (sudo !! is a classic).
  10. 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.

⌃R

Learn Terminal shortcuts with quick quizzes

Keyhab quizzes you on 1,050 shortcuts for 15 tools, from Basics to Advanced. Five minutes a day on iPhone or iPad — VSCode (Mac) and Vim Basics are free.

Download free on the App Store

Related