Skip to content
Go back

Essential Linux Terminal Key Bindings for Efficient Command Line Editing

Published:

Essential Linux Terminal Key Bindings for Efficient Command Line Editing

Mastering terminal key bindings is one of the fastest ways to improve your command-line efficiency. These shortcuts allow you to navigate, edit, and control your terminal sessions with speed and precision.

These bindings are primarily for the Bash and Zsh shells, which are the most common defaults.

Cursor Navigation

Key BindingDescription
Ctrl + AMove cursor to the Beginning of the line.
Ctrl + EMove cursor to the End of the line.
Alt + BMove cursor Back one word.
Alt + FMove cursor Forward one word.
Ctrl + BMove cursor Back one character (same as Left Arrow).
Ctrl + FMove cursor Forward one character (same as Right Arrow).

Text Editing

Key BindingDescription
Ctrl + UCut/Kill from cursor to the beginning of the line.
Ctrl + KCut/Kill from cursor to the end of the line.
Ctrl + WCut/Kill the word before the cursor.
Alt + DCut/Kill the word after the cursor.
Ctrl + YPaste (Yank) the last killed text.
Ctrl + DDelete the character under the cursor (Exit shell if line is empty).
Ctrl + HDelete the character before the cursor (Backspace).
Ctrl + TSwap the current character with the previous one.
Alt + TSwap the current word with the previous one.
Ctrl + _Undo the last edit.

Process Control

Key BindingDescription
Ctrl + CInterrupt/Kill the current foreground process.
Ctrl + ZSuspend the current process (resume with fg or bg).
Ctrl + DExit the current shell (End-of-File).
Ctrl + LClear the terminal screen (same as clear command).
Ctrl + SPause terminal output (lock the screen).
Ctrl + QResume terminal output (unlock the screen).

History Commands

Key BindingDescription
Ctrl + RReverse Search through command history.
Ctrl + GEscape from history search mode.
Up ArrowNavigate backward through history.
Down ArrowNavigate forward through history.
Ctrl + PPrevious command in history (same as Up Arrow).
Ctrl + NNext command in history (same as Down Arrow).
!!Repeat the last command.
!<word>Repeat the last command that started with <word>.

Tab Completion

Key BindingDescription
TabAuto-complete file, command, or directory name.
Tab Tab (Press twice)Show all possible completions when ambiguous.
Alt + *Insert all possible completions (useful for seeing files).

Tips for Mastery

Integrating even a handful of these bindings into your daily workflow will dramatically speed up your interaction with the Linux terminal.


Suggest Changes

Previous Post
Local Node.js App with HTTPS on Ubuntu 22.04 Using Self-Signed SSL, Nginx & Apache Reverse Proxy
Next Post
Setup mysql Master-Slave Replication On Ubuntu