A mistyped word at the start of a long command or forgotten options from yesterday’s session can slow you down in the terminal. This Bash shortcuts cheat sheet helps you edit commands, navigate the command line, and search your command history with fewer keystrokes.
This Bash shortcuts cheat sheet helps you with those small interruptions. You will learn how to recover previous commands, change only text that needs fixing, reuse the arguments, handle a running job without closing your terminal.
This guide is designed for developers, Linux beginners, and anyone who regularly works with Bash in a terminal. Start with quick reference, then try examples to understand what each shortcut actually does.
TL;DR
- Use Ctrl+R to find previous command, then review it before running it.
- Jump with Ctrl+A, Ctrl+E, Alt+B, and Alt+F instead of moving one character at time.
- Cut text with Ctrl+W, Ctrl+U, or Ctrl+K; restore it with Ctrl+Y.
- Use Tab for completion and Alt+. to insert previous command’s last argument.
- Remember that Ctrl+C, Ctrl+Z, and Ctrl+D have different purposes.
Quick reference: choose the shortcut for the task
These keyboard shortcuts work with Bash’s Emacs editing mode. Terminal settings and personal configuration can change them.
Before you start: check which shortcuts your shell uses
Bash uses Readline, its interactive line-editing library, to handle most shortcuts in this guide. These keys operate at Bash prompt; a program running inside terminal may interpret them differently.
Bash uses the GNU Readline library for interactive command-line editing, and you can explore its available editing modes and commands in the official Bash command-line editing documentation.
Check your current Bash version:
printf '%s\n' "$BASH_VERSION"
In Bash, this prints a version string. If no output appears, you might be running a different shell.
To inspect editing modes, run:
set -o
You can see output as mentioned below:
Read Full Article: https://serveravatar.com/bash-shortcuts-cheat-sheet


Top comments (0)