Skip to Content
DocsKeyboard Shortcuts

Keyboard Shortcuts

The terminal supports the bash/readline shortcuts people’s fingers already know. Click the terminal to focus it, and try them here:

Run a few commands, then press Ctrl+R and type part of one. Or type a long line and use Ctrl+A, Alt+F, Ctrl+W and Ctrl+Y.

Completion and history

KeysAction
Tab, Ctrl+IComplete a command or path. Press again to cycle through options.
↑ / ↓, Ctrl+P / Ctrl+NPrevious / next command in history
Ctrl+RSearch history backward. Press again for older matches.
Ctrl+SSearch history forward
Ctrl+ORun the current line (or search match) and load the next history entry

Tab completion adds / after folders and a space after files, quotes names with spaces, and completes commands after a |. Hidden files are only offered when you start typing a ..

While searching history

When you press Ctrl+R, the prompt becomes (reverse-i-search)`query': match. Then:

KeysAction
Type / BackspaceRefine the search
Ctrl+R / Ctrl+SNext older / newer match
EnterRun the match
Esc, arrow keys, TabKeep the match on the line so you can edit it
Ctrl+GCancel and restore what you had typed
Ctrl+CCancel

Moving the cursor

KeysAction
Ctrl+A / Ctrl+EStart / end of the line
Ctrl+B / Ctrl+FBack / forward one character
Alt+B / Alt+FBack / forward one word
← / →Back / forward one character

Editing

KeysAction
Ctrl+HDelete the character before the cursor (like Backspace)
Ctrl+DDelete the character under the cursor
Ctrl+UCut from the cursor to the start of the line
Ctrl+KCut from the cursor to the end of the line
Ctrl+WCut the previous word (up to whitespace)
Alt+BackspaceCut the previous word (up to punctuation)
Alt+DCut the next word
Ctrl+YPaste the last cut text
Ctrl+TSwap the two characters before the cursor
Alt+.Insert the last argument of the previous command

Screen and running commands

KeysAction
EnterRun the line
Ctrl+CCancel the line (shows ^C) or stop a running sleep
Ctrl+LClear the screen but keep the current line

If text is selected on the page, Ctrl+C copies it instead of cancelling.

Browsers keep a few shortcuts for themselves and never pass them to the page. On Windows and Linux, Chrome reserves Ctrl+W (close tab), Ctrl+N (new window) and Ctrl+T (new tab). On macOS every shortcut works, because browser shortcuts use Cmd instead of Ctrl.

Alt is Option on a Mac.

Last updated on