Terminal / Bash Keyboard Shortcuts
Complete keyboard shortcut reference for Terminal / Bash on MacWindowsLinux.
Cursor Movement
| Action | Shortcut |
|---|---|
| Move cursor to beginning of line | CtrlAHomeCtrlA |
| Move cursor to end of line | CtrlEEndCtrlE |
| Move cursor forward one character | CtrlFRightCtrlF |
| Move cursor backward one character | CtrlBLeftCtrlB |
| Move cursor forward one word | AltFCtrlRightAltF |
| Move cursor backward one word | AltBCtrlLeftAltB |
| Move cursor to beginning of line (Home key) | HomeHomeHome |
| Move cursor to end of line (End key) | EndEndEnd |
Text Editing
| Action | Shortcut |
|---|---|
| Delete character under cursor | CtrlDDeleteCtrlD |
| Delete character before cursor | CtrlHBackspaceCtrlH |
| Delete word before cursor | CtrlWCtrlBackspaceCtrlW |
| Delete word after cursor | AltDCtrlDeleteAltD |
| Delete from cursor to end of line | CtrlKCtrlKCtrlK |
| Delete from cursor to beginning of line | CtrlUCtrlUCtrlU |
| Paste last deleted text (yank) | CtrlYCtrlYCtrlY |
| Transpose characters | CtrlTCtrlTCtrlT |
| Uppercase word from cursor | AltUAltUAltU |
| Lowercase word from cursor | AltLAltLAltL |
| Capitalize word from cursor | AltCAltCAltC |
History
| Action | Shortcut |
|---|---|
| Previous command in history | CtrlPUpCtrlP |
| Next command in history | CtrlNDownCtrlN |
| Previous command (arrow key) | UpUpUp |
| Next command (arrow key) | DownDownDown |
| Go to first command in history | Alt<Alt<Alt< |
| Go to last command in history | Alt>Alt>Alt> |
| Run the last command again | !!Enter!!Enter!!Enter |
| Recall last argument of previous command | Alt.Alt.Alt. |
Process Control
| Action | Shortcut |
|---|---|
| Interrupt (kill) current process | CtrlCCtrlCCtrlC |
| Suspend current process (background) | CtrlZCtrlZCtrlZ |
| End of input (close shell if empty) | CtrlDCtrlDCtrlD |
| Quit (send SIGQUIT) | Ctrl\Ctrl\Ctrl\ |
| Stop output to screen | CtrlSCtrlSCtrlS |
| Resume output to screen | CtrlQCtrlQCtrlQ |
| Send EOF marker on current line | CtrlDCtrlDCtrlD |
| Discard current line and get new prompt | CtrlCCtrlCCtrlC |
Screen & Output
| Action | Shortcut |
|---|---|
| Clear the screen | CtrlLCtrlLCtrlL |
| Clear screen (Cmd shortcut) | CmdKCtrlLCtrlL |
| Scroll up in terminal | CmdUpCtrlShiftUpShiftPageUp |
| Scroll down in terminal | CmdDownCtrlShiftDownShiftPageDown |
| Scroll to top of buffer | CmdHomeCtrlHomeShiftHome |
| Scroll to bottom of buffer | CmdEndCtrlEndShiftEnd |
| Increase font size | Cmd+Ctrl+Ctrl+ |
| Decrease font size | Cmd-Ctrl-Ctrl- |
Tab Completion
| Action | Shortcut |
|---|---|
| Auto-complete file or command name | TabTabTab |
| Show all possible completions | TabTabTabTabTabTab |
| List possible completions | Alt?Alt?Alt? |
| Insert all possible completions | Alt*Alt*Alt* |
| Attempt completion and list if ambiguous | Alt=Alt=Alt= |
| Undo last completion | Ctrl_Ctrl_Ctrl_ |
Search
| Action | Shortcut |
|---|---|
| Reverse search command history | CtrlRCtrlRCtrlR |
| Forward search command history | CtrlSCtrlSCtrlS |
| Abort search and restore original line | CtrlGCtrlGCtrlG |
| Accept search result and execute | EnterEnterEnter |
| Accept search result and edit | EscEscEsc |
| Search again for next match (reverse) | CtrlRCtrlRCtrlR |
| Non-incremental reverse search | AltPAltPAltP |
| Non-incremental forward search | AltNAltNAltN |
No shortcuts found. Try a different search term.
Frequently Asked Questions
What is the fastest way to search through command history in the terminal?
Press Ctrl+R to start a reverse incremental search. Type a few characters of the command you're looking for, and the shell will find the most recent match. Press Ctrl+R again to cycle through older matches. Press Enter to execute the found command, or Esc to edit it before running.
How do I clear the terminal screen without losing scroll history?
Press Ctrl+L to clear the visible screen while keeping your scroll-back buffer intact. On macOS Terminal, Cmd+K clears the entire scroll-back buffer. You can also type the 'clear' command for the same effect as Ctrl+L.
What is the difference between Ctrl+C and Ctrl+Z in the terminal?
Ctrl+C sends a SIGINT signal that interrupts and typically terminates the current running process. Ctrl+Z sends a SIGTSTP signal that suspends the process and puts it in the background. You can resume a suspended process with the 'fg' command (foreground) or 'bg' command (background).
How do I delete an entire line quickly in the terminal?
Use Ctrl+U to delete from the cursor to the beginning of the line, or Ctrl+K to delete from the cursor to the end. To clear the whole line regardless of cursor position, press Ctrl+A (go to start) followed by Ctrl+K (delete to end). You can paste the deleted text back with Ctrl+Y.
Are terminal keyboard shortcuts the same on Mac, Windows, and Linux?
Most readline-based shortcuts (Ctrl+A, Ctrl+E, Ctrl+R, Ctrl+K, etc.) work the same in Bash and Zsh across all platforms. The main differences are in terminal application shortcuts: macOS Terminal uses Cmd+K to clear, Cmd+T for new tabs, and Cmd+N for new windows, while Windows Terminal and Linux terminal emulators use their own application-level shortcuts.