Complete Guide to Keyboard Shortcuts for Bash

Last update: 19 September 2026
  • Quick navigation and editing techniques to avoid excessive use of arrows and backtracking.
  • Advanced methods for searching and repeating commands using the Bash history.
  • Efficient management of foreground and background processes and control of terminal output.

Close-up of hands typing on a laptop keyboard with code displayed on the screen, representing agility in using keyboard shortcuts.

If you've ever felt like you spend more time wrestling with the keyboard than writing code, you're not alone. Many of us started in the Linux terminal typing everything by hand, deleting letter by letter and juggling the arrow keys, unaware that there's a whole universe of keyboard shortcuts designed to make us fly around the command line.

Mastering Bash isn't just about knowing the commands, but about being able to manipulate text input with agility. Going from novice to advanced user means abandoning the mouse and taking advantage of the built-in Emacs-like editing capabilities , which saves a huge amount of time and, above all, reduces frustration when correcting those common typos.

Linux tricks
Related articles:
Linux tricks: commands and shortcuts to master the terminal

Quick navigation through the command line

Backlit keyboard with developer aesthetics and background code, ideal for illustrating terminal efficiency.

Moving the cursor letter by letter is a complete waste of time. To jump directly to the start of the lineThe easiest thing to do is press Ctrl + AWhereas if you need to get away quickly to end of commandThe key is Ctrl + EThis combination is essential for anyone who handles very long file paths.

If you need to move more precisely but without going letter by letter, you can skip entire words. We use Alt+B (o I followed by the left arrow) to go back one word, and Alt + F (o I (plus right arrow) to move forward. There's also a very handy trick: Ctrl + X followed by Ctrl + X allow toggle cursor between the current position and the beginning of the line, ideal for making quick adjustments at the start and returning to the point where you were.

linux file management commands
Related articles:
Mastering File Management in Linux: A Complete Command Guide

Editing tricks and surgical deletion

Advanced terminal interface with multiple data panels, reflecting the environment of an expert Bash user.

Sometimes we make a mistake and want to erase everything without having to mash the backspace key. To clear everything... from the cursor backwardswe use Ctrl + UConversely, if we want to delete everything that follows the cursor to the end of the line, Ctrl + K it is the perfect tool.

  GPT-5.1 Codex vs Claude Code: the benchmark that actually matters

For more specific deletions, Ctrl + W Remove the previous word using the space as a separator, while Alt + Backspace It's more accurate, as it erases the word based on non-alphanumeric characters. If you've made a mistake by just one letter, Ctrl + T allow exchange the current character with the previous one, correcting typos in a second. To move entire words, Alt+T swap the current word with the previous one.

We cannot forget the management of uppercase and lowercase letters. Alt+U Converts to uppercase from the cursor to the end of the word, Alt + L He does everything in lowercase and Alt+C Capitalize the first letter and move the cursor to the end. If you've made a mess of editing, Ctrl+_ (usually Ctrl + Shift + -) is used for undo the last change, and Alt + R Reverts the entire line to its original state.

tricks for computer programs
Related articles:
Computer program tricks that multiply your productivity

Mastering history and command repetition

Person programming in a dark environment, focusing on physical interaction with the keyboard for the use of commands.

Searching for old commands is one of the most frequent tasks. Instead of pressing the up arrow a hundred times, the smarter thing to do is use Ctrl + R to perform a reverse search in historySimply type part of the command and Bash will find the latest match. If you want to continue searching for older matches, press Enter again. Ctrl + RTo exit this search mode without doing anything, use Ctrl + G.

There are very quick ways to repeat tasks. The command !! It executes exactly the last thing you typed (very useful when you forget to put sweat before a commandIf you only need the last argument of the previous command, you can use !$ o Alt +.thus avoiding having to copy and paste complex paths.

  How to create a multiboot USB drive with Ventoy and manage multiple ISOs

For the most demanding users, there are advanced expansions: !* repeats all the arguments of the last command, and the syntax ^old^new allow execute the previous command replacing One word for another. If you want to see which command will be executed before launching it, !:p It will print the last command on the screen without executing it.

automation in Linux
Related articles:
Automation in Linux: from cron and Bash to Ansible and systemd

Process control and terminal management

When a program freezes or we simply want to stop it, Ctrl + C sends an interrupt signal (SIGINT) to kill the current processIf, on the other hand, we don't want to close the program but pause it to do something else, we use Ctrl + ZThis suspends the task and returns the prompt; we can then resume it in the background with bg or bring her to the front with fg.

Screen management is simple: Ctrl + L It cleans the terminal instantly, working just like the command clearSomething curious and sometimes problematic is Ctrl + S, which stops the text output on the screen (it seems as if the terminal has frozen), and CTRL+Q, which is the key needed to resume viewing of the output.

Finally, autocomplete with the key Tab It's the Bash user's best friend. Pressing once completes the name if it's unique, and pressing twice shows all the Available optionsTo close the current session or send an end-of-file (EOF) marker, Ctrl + D is the standard option.

Considerations regarding the clipboard and special keys

It's important to differentiate between what Bash does and what a terminal emulator (like Kitty or Alacritty) does. For example, Ctrl + V Many emulators paste the contents of the system clipboard, but in pure Bash, Ctrl + V It serves for insert the following character literally. If you press Ctrl + V and then EnterYou'll see it appear ^M instead of skipping a line.

  FreeXP: Reviving Windows XP with the security of Linux

The command Ctrl + Y (yank) is an internal Bash script and is used for paste the text that we have previously cut with Ctrl + U, Ctrl + K o Ctrl + WNote that this is an internal shell clipboard and is completely independent of your operating system's general clipboard.

Integrating these tools into daily life makes interaction with the system much smoother, transforming the terminal into a natural extension of our thinking by allowing us to edit, search and control processes without taking our hands off the writing position, optimizing every second of our workday.

WSL2 Zsh automation
Related articles:
Complete WSL2 automation with Zsh and Oh My Zsh on Windows