Bash Keyboard Shortcuts: The Complete Cheat Sheet

Bash keyboard shortcuts are key combinations powered by the GNU Readline library that let you move the cursor, edit a command, search your history, and control running processes without ever touching the mouse or arrow keys. Learning even a dozen of them will noticeably speed up how fast you work in the terminal.

This guide lists every essential shortcut, explains exactly what each one does, and shows you how to use, customize, and troubleshoot them on Linux, macOS, and WSL. A free printable PDF is at the bottom.

What Are Bash Shortcuts?

Bash is the default shell on most Linux distributions and was the default on macOS until Catalina. Every time you type at the prompt, you’re actually using Readline, which intercepts key combinations and turns them into editing actions jump to the start of the line, delete a word, recall an old command, and so on.

These shortcuts fall into five practical groups:

  • Navigation: move the cursor around the line
  • Editing: change, cut, paste, and transform text
  • History: recall and search previous commands
  • Process control: manage what’s currently running
  • History expansion (!): reuse parts of past commands

Navigation Shortcuts

Use these to move the cursor without holding down the arrow keys. Ctrl + A and Ctrl + E are the two most useful shortcuts in all of Bash learn these first.

ShortcutAction
Ctrl + AMove to the beginning of the line
Ctrl + EMove to the end of the line
Ctrl + FMove forward one character
Ctrl + BMove backward one character
Alt + FMove forward one word
Alt + BMove backward one word
Ctrl + XXToggle between the start of the line and the current cursor position

Editing Shortcuts

These let you cut, paste, delete, and transform text on the current line. Bash keeps cut text in a kill ring, so anything you cut with Ctrl + W, Ctrl + K, or Ctrl + U can be pasted back with Ctrl + Y.

ShortcutAction
Ctrl + WCut the word before the cursor
Ctrl + KCut everything after the cursor to the end of the line
Ctrl + UCut everything before the cursor to the start of the line
Ctrl + YPaste (yank) the last text you cut
Alt + DDelete the word after the cursor
Alt + BackspaceDelete the word before the cursor
Ctrl + DDelete the character under the cursor
Ctrl + HDelete the character before the cursor (same as Backspace)
Ctrl + TSwap (transpose) the last two characters before the cursor
Alt + TSwap the current word with the previous one
Alt + UUppercase from the cursor to the end of the word
Alt + LLowercase from the cursor to the end of the word
Alt + CCapitalize the character under the cursor and move to the end of the word
Alt + RRevert all changes to a line you pulled from history
Ctrl + _Undo the last edit (repeatable)

History & Reverse Search

This is where shortcuts save the most time. Instead of pressing the Up arrow twenty times, search your history directly.

ShortcutAction
Ctrl + RReverse-search your command history as you type
Ctrl + SSearch history forward (see the note below)
Ctrl + PPrevious command (same as Up arrow)
Ctrl + NNext command (same as Down arrow)
Ctrl + ORun the command found via search, then load the next one
Ctrl + GAbort the search and return to a clean prompt
Ctrl + JAccept the found command without running it
Alt + .Insert the last argument of the previous command

How to use Ctrl + R (reverse search)

  1. Press Ctrl + R.
  2. Start typing any part of a past command (e.g. ssh).
  3. Bash shows the most recent match. Press Ctrl + R again to step further back through matches.
  4. Press Enter to run it, → / Ctrl + E to edit it first, or Ctrl + G to cancel.

About Ctrl + S: In many terminals Ctrl + S freezes the screen (XOFF flow control) instead of searching forward. If it locks up your terminal, press Ctrl + Q to unfreeze. To free up Ctrl + S for forward search, add stty -ixon to your ~/.bashrc.

Alt + . is a hidden gem: After running mkdir /very/long/path/name, type cd then press Alt + . to instantly paste /very/long/path/name.

Process Control Shortcuts

These manage the program currently running in your terminal.

ShortcutAction
Ctrl + CInterrupt (kill) the current process — sends SIGINT
Ctrl + ZSuspend the current process — sends SIGTSTP (resume with fg or bg)
Ctrl + DSend EOF; on an empty prompt, exits the shell
Ctrl + LClear the screen (same as the clear command)
Ctrl + SPause output to the screen (XOFF)
Ctrl + QResume paused output (XON)

History Expansion with ! (Bang)

The ! character lets you reuse past commands and their arguments. These aren’t keystrokes you type them as part of a command.

SyntaxWhat it doesExample
!!Repeat the previous commandsudo !! reruns your last command with sudo
!abcRun the most recent command starting with abc!ssh reruns your last ssh …
!abc:pPrint (don’t run) the last command starting with abcLets you review before executing
!$\vert{} The last argument of the previous command \vert{} mkdir test && cd !$
!*All arguments of the previous command
!nRun command number n from history!42
^old^newRerun the last command, replacing old with new^typo^fixed

Tip: Run history to see numbered past commands, then use !n to rerun any of them.

Download the Bash Shortcuts PDF

Download the complete Bash Shortcuts cheat sheet (PDF) print it and keep it next to your keyboard.

Frequently Asked Questions

How do I see all Bash keyboard shortcuts on my system?

Run bind -P to list every active Readline binding, or bind -p for a remappable format.

Why don’t my Bash shortcuts work over SSH?

The remote session uses its own terminal and Readline settings. Differences in TERM, tmux/screen, or stty flow control can change how keys behave. Local ~/.inputrc customizations also don’t travel with you over SSH.

What’s the difference between emacs mode and vi mode?

Emacs mode (the default) uses direct key combinations like Ctrl + A. Vi mode is modal — you press Esc to enter command mode and use Vim-style keys. Switch with set -o vi or set -o emacs.

How do I use Ctrl + R reverse search?

Press Ctrl + R, type part of a past command, press Ctrl + R again to cycle older matches, then Enter to run or Ctrl + G to cancel.

Do Bash shortcuts work on macOS?

Yes, but macOS defaults to zsh and treats the Option key specially. Enable “Use Option as Meta key” in your terminal settings so Alt-based shortcuts work.

How do I create my own Bash shortcut?

Add a binding to ~/.inputrc (for editing actions) or use bind ‘”\C-g”:”git status\n”‘ in ~/.bashrc (to bind a key to a command).

Final Thoughts

Mastering Bash shortcuts is one of the highest-return habits you can build as a developer or sysadmin every keystroke you save compounds across thousands of commands. Start with the two that matter most, Ctrl + A and Ctrl + E, then add Ctrl + R for history search and Alt + . for reusing your last argument. Within a week they’ll feel automatic.

Because every shortcut here is powered by GNU Readline, the same muscle memory carries over to other Readline-based tools like the Python REPL, psql, and many other command-line programs. Bookmark this page, grab the PDF, and run bind -P whenever you want to see every binding your shell supports.

READ NEXT:

Pratik

Pratik is the founder of Tutorial Tactic and a productivity tools specialist with 15 years of hands-on experience in Google Workspace, Microsoft Office, and software automation. He has published over 1,500 guides on keyboard shortcuts, software commands, how-to tutorials and workflow optimization, helping readers across the US and India work faster with the tools they use every day. Tutorial Tactic was founded in 2021 with one goal: cut through the noise and give readers exactly what they need fast, verified, and beginner-friendly.
Back to top button