Terminal

Terminal & iTerm2 Keyboard Shortcuts

Essential keyboard shortcuts for Terminal, iTerm2, and common shell navigation - line editing, history, tabs, and panes.

Line Editing (Readline / Emacs Mode)

ShortcutAction
Ctrl+AMove cursor to beginning of line
Ctrl+EMove cursor to end of line
Ctrl+FMove cursor forward one character
Ctrl+BMove cursor backward one character
Alt+F / Opt+FMove forward one word
Alt+B / Opt+BMove backward one word
Ctrl+UDelete from cursor to beginning of line
Ctrl+KDelete from cursor to end of line
Ctrl+WDelete word before cursor
Alt+D / Opt+DDelete word after cursor
Ctrl+DDelete character under cursor (or exit shell)
Ctrl+HDelete character before cursor (backspace)
Ctrl+TTranspose characters
Alt+T / Opt+TTranspose words
Ctrl+YPaste (yank) last deleted text
Alt+Y / Opt+YCycle through yank ring
Ctrl+_Undo last edit
Ctrl+XXToggle between cursor position and beginning of line

History

ShortcutAction
Ctrl+RReverse search history
Ctrl+SForward search history
Ctrl+P / UpPrevious command in history
Ctrl+N / DownNext command in history
Alt+. / Opt+.Insert last argument of previous command
!!Repeat last command
!$Last argument of previous command
!*All arguments of previous command
!abcRun last command starting with “abc”
^old^newReplace “old” with “new” in last command
Ctrl+GCancel history search
historyShow full command history

Process Control

ShortcutAction
Ctrl+CKill current foreground process
Ctrl+ZSuspend current process (background)
Ctrl+DSend EOF (exit shell if line is empty)
Ctrl+SPause terminal output
Ctrl+QResume terminal output
Ctrl+LClear screen (keep history)
fgResume suspended job in foreground
bgResume suspended job in background
jobsList background jobs

iTerm2 Specific

ShortcutAction
Cmd+TNew tab
Cmd+WClose tab/pane
Cmd+DSplit pane vertically
Cmd+Shift+DSplit pane horizontally
Cmd+]Next pane
Cmd+[Previous pane
Cmd+Opt+ArrowNavigate between panes
Cmd+Shift+EnterMaximize/restore pane
Cmd+Left / Cmd+RightSwitch tabs
Cmd+1-9Jump to tab by number
Cmd+FFind in terminal
Cmd+Shift+HPaste history
Cmd+;Autocomplete
Cmd+Opt+EExpose all tabs
Cmd+/Find cursor
Cmd+EnterToggle fullscreen
Cmd+Shift+IBroadcast input to all panes
Cmd+KClear buffer
Cmd+Shift+OOpen quickly (search sessions)

macOS Terminal.app

ShortcutAction
Cmd+TNew tab
Cmd+NNew window
Cmd+WClose tab
Cmd+Shift+Left/RightSwitch tabs
Cmd+DSplit window (macOS Sequoia+)
Cmd+KClear to start
Cmd+,Preferences
Cmd+IInspector (window info)

Useful Shell Aliases

Alias/CommandAction
alias ll='ls -la'Long listing with hidden files
alias ..='cd ..'Go up one directory
alias ...='cd ../..'Go up two directories
alias gs='git status'Git status shortcut
alias gp='git push'Git push shortcut
Ctrl+R then typeFuzzy search command history
cd -Return to previous directory
pushd / popdDirectory stack navigation