Skip to main content

53 shortcuts · Mac only

Terminal on macOS Keyboard Shortcuts

Updated

Two different keyboard layers meet in a Mac terminal window. Terminal.app supplies the Cmd shortcuts — tabs, splits, find, clearing the scrollback. The shell underneath supplies the Ctrl shortcuts, which come from the readline library and let you edit a command line without arrow-keying across it one character at a time. Learning the second layer is what makes long commands painless.

Platforms covered: macOS only. The Cmd shortcuts belong to Terminal.app itself, and the Ctrl shortcuts are the Emacs-style line editing that bash and zsh use by default. The Windows column is an em dash because Terminal.app is a Mac application.

Terminal windows, tabs and splits

Terminal on macOS keyboard shortcuts — Terminal windows, tabs and splits. Windows keys, Mac keys and what each one does.
WindowsMacAction
Not available on this platformCmdNOpen a new Terminal window
Not available on this platformCmdTOpen a new tab
Not available on this platformCmdWClose the tab
Not available on this platformCmdShiftWClose the window
Not available on this platformCmdDSplit the window into two panes
Not available on this platformCmdShiftDClose the split pane
Not available on this platformCmdShift[Go to the previous tab
Not available on this platformCmdShift]Go to the next tab
Not available on this platformCmd1 … 9Switch to that numbered tab
Not available on this platformCmdPlusMake the text bigger
Not available on this platformCmdMinusMake the text smaller
Not available on this platformCtrlCmdFToggle full screen
Not available on this platformCmd,Open Terminal settings

Editing the command line

Terminal on macOS keyboard shortcuts — Editing the command line. Windows keys, Mac keys and what each one does.
WindowsMacAction
Not available on this platformCtrlAMove to the beginning of the line
Not available on this platformCtrlEMove to the end of the line
Not available on this platformCtrlBMove back one character
Not available on this platformCtrlFMove forward one character
Not available on this platformOptionLeft arrowMove back one word
Not available on this platformOptionRight arrowMove forward one word
Not available on this platformCtrlUDelete everything before the cursor
Not available on this platformCtrlKDelete everything after the cursor
Not available on this platformCtrlWDelete the word before the cursor
Not available on this platformCtrlYPaste back whatever you last deleted
Not available on this platformCtrlDDelete the character under the cursor
Not available on this platformCtrlTSwap the last two characters
Not available on this platformCtrlUnderscoreUndo the last edit
Not available on this platformCtrlLClear the screen and keep the line you were typing

Running and stopping commands

Terminal on macOS keyboard shortcuts — Running and stopping commands. Windows keys, Mac keys and what each one does.
WindowsMacAction
Not available on this platformEnterRun the command
Not available on this platformTabComplete the command or filename
Not available on this platformTabtwiceList every possible completion
Not available on this platformCtrlCInterrupt the running command
Not available on this platformCtrlZSuspend the running command and get the prompt back
Not available on this platformCtrlDSend end-of-file, or log out when the line is empty
Not available on this platformCtrlSPause the output scrolling past
Not available on this platformCtrlQResume the output after Ctrl + S
Not available on this platformCmd.Send an interrupt, the same as Ctrl + C

Command history

Terminal on macOS keyboard shortcuts — Command history. Windows keys, Mac keys and what each one does.
WindowsMacAction
Not available on this platformUp arrowRecall the previous command
Not available on this platformDown arrowMove forward through the history
Not available on this platformCtrlPRecall the previous command
Not available on this platformCtrlNMove to the next command
Not available on this platformCtrlRSearch backwards through the history as you type
Not available on this platformCtrlRtwiceStep back to the next older match
Not available on this platformCtrlGAbandon the history search
Not available on this platform!!Repeat the previous command
Not available on this platform!$Reuse the last argument of the previous command

Copying, finding and scrollback

Terminal on macOS keyboard shortcuts — Copying, finding and scrollback. Windows keys, Mac keys and what each one does.
WindowsMacAction
Not available on this platformCmdCCopy the selection
Not available on this platformCmdVPaste
Not available on this platformCmdASelect everything in the window
Not available on this platformCmdFFind in the terminal window
Not available on this platformCmdKClear the scrollback buffer
Not available on this platformCmdUp arrowJump to the previous command prompt
Not available on this platformCmdDown arrowJump to the next command prompt
Not available on this platformCmdShiftASelect the output between two prompts

Terminal on macOS shortcuts — common questions

Do these work in iTerm2, Warp or the VS Code terminal?
The Ctrl shortcuts do, because they come from the shell rather than from Terminal.app — they work anywhere bash or zsh is running, including on Linux. The Cmd shortcuts belong to Terminal.app; other Mac terminal apps implement most of the same ones, with their own additions for panes and profiles.
Why do Option + Left arrow and Option + Right arrow do nothing?
Terminal has to send those keys to the shell as meta sequences, and it only does so when the option is switched on. Open Terminal → Settings → Profiles → Keyboard and tick "Use Option as Meta key". Word-wise movement then works on the command line as it does elsewhere on the Mac.
What is the difference between Ctrl + C and Ctrl + Z?
Ctrl + C interrupts the running command and ends it. Ctrl + Z suspends it and hands you the prompt back with the job still alive in the background — bring it forward again with fg, or leave it running in the background with bg. Ctrl + Z is what to reach for when you did not mean to kill the work.
How do I search my command history instead of pressing Up repeatedly?
Press Ctrl + R and start typing any part of the command; the most recent match appears at the prompt. Press Ctrl + R again to step further back through the matches, Enter to run the one shown, or Ctrl + G to abandon the search and keep whatever you had typed.