Boost Linux Terminal Efficiency with 10 Essential Keyboard Shortcuts
This guide lists ten indispensable Linux terminal shortcuts, explains the situations where each key combination shines, provides concrete command‑line examples and tips, and shows how mastering them can raise your workflow speed by more than 50%.
Why you need to learn shortcuts
Common pain points when typing long commands include misspelling a command and having to re‑type it, repeatedly executing the previous command, scrolling through history with the up‑arrow key, and moving the cursor solely with arrow keys.
Mastering the ten shortcuts below makes command‑line work feel lightning‑fast.
1. Move the cursor – ditch the arrow keys
Ctrl+A – Jump to line start
Scenario: You are at the end of a command and need to edit the beginning.
# cursor at end
sudo apt install docker-ce docker-ce-cli containerd.io
# press Ctrl+A, cursor jumps to start
|sudo apt install docker-ce docker-ce-cli containerd.ioCtrl+E – Jump to line end
Scenario: You are at the start of a command and want to append arguments.
# cursor at start
sudo apt update
# press Ctrl+E, cursor jumps to end
sudo apt update|Ctrl+B – Move one character left (←)
Scenario: Precise cursor positioning is required.
# cursor at end
sudo apt update|
# press Ctrl+B, cursor moves left one character
sudo apt updat|eCtrl+F – Move one character right (→)
Scenario: You need to move the cursor right.
# cursor in the middle
sudo |apt update
# press Ctrl+F, cursor moves right one character
sudo a|pt updateTip: Using Ctrl+B/F keeps your hands on the main keyboard area, which is faster than reaching for the arrow keys.
2. Delete content – say goodbye to backspace
Ctrl+U – Delete everything before the cursor
Scenario: You typed a long command but realized the logic is wrong and want to start over.
# before deletion
sudo apt install docker-ce docker-ce-cli containerd.io
# press Ctrl+U, everything before the cursor is removed
|Ctrl+K – Delete everything after the cursor
Scenario: The command is too long and you only want to keep the first part.
# before deletion
sudo apt update && sudo apt upgrade -y
# cursor after "update", press Ctrl+K
sudo apt update|Ctrl+W – Delete the previous word
Scenario: You need to remove a specific parameter.
# before deletion
sudo apt install nginx
# cursor after "nginx", press Ctrl+W
sudo apt install |Ctrl+Y – Paste the most recently deleted text
Scenario: You accidentally deleted something and want to restore it.
# after using Ctrl+U to delete
|
# press Ctrl+Y, the deleted text reappears
sudo apt install docker-ce docker-ce-cli containerd.ioTip: After deleting a word with Ctrl+W, you can immediately press Ctrl+Y to paste it elsewhere, effectively moving the word.
3. History commands – avoid re‑typing
Ctrl+R – Search command history
Scenario: You want to run a previous command but can’t recall the exact text.
# press Ctrl+R to enter reverse search mode
(reverse-i-search)`docker': sudo apt install docker-ce
# press Enter to execute, or → to editAdvanced tip:
Press Ctrl+R repeatedly to see older matches.
Press Ctrl+G to abort the search.
!! – Repeat the last command
Scenario: The previous command failed because you forgot to prepend sudo.
# failed command
apt update
E: Could not open lock file /var/lib/apt/lists/lock - open (13 Permission denied)
# use sudo !! to repeat with sudo
sudo !!
# expands to
sudo apt updateRelated shortcuts:
!$ – the last argument of the previous command.
!* – all arguments of the previous command.
# create a directory
mkdir -p /tmp/test/project
# change into it using !$
cd !$
# expands to
cd /tmp/test/project
# view a log file
cat /var/log/syslog
# open it with less using !*
less !*
# expands to
less /var/log/syslog4. Other handy shortcuts
Ctrl+L – Clear the screen
Scenario: The terminal is cluttered and you want a clean view.
# press Ctrl+L, equivalent to the clear command
# screen is cleared, cursor returns to topCtrl+C – Terminate the current command
Scenario: A command runs too long and you need to stop it.
# running command
ping google.com
# press Ctrl+C to abort
^CCtrl+Z – Suspend the current command
Scenario: You want to pause a running process and resume later.
# suspend vim
vim file.txt
# press Ctrl+Z
[1]+ Stopped vim file.txt
# resume in foreground
fg
# or resume in background
bgCtrl+D – Exit the current shell
Scenario: Quickly leave the terminal, equivalent to typing exit.
# press Ctrl+D
logout5. Hands‑on practice
Scenario 1 – Editing a long command
# entered a long command with wrong parameter order
sudo apt install docker-ce containerd.io docker-ce-cli
# Ctrl+A to jump to start
|sudo apt install docker-ce containerd.io docker-ce-cli
# Ctrl+F to move right after "install"
sudo apt install| docker-ce containerd.io docker-ce-cli
# Ctrl+W to delete "docker-ce"
sudo apt install| containerd.io docker-ce-cli
# type new parameter
sudo apt install docker-ce |containerd.io docker-ce-cli
# Ctrl+Y to paste the previously deleted "docker-ce"
sudo apt install docker-ce docker-ce containerd.io docker-ce-cliScenario 2 – Quickly run a previous command
# 1. Search for a previous docker command
Ctrl+R → type "docker"
# 2. Press → to edit or Enter to execute
# 3. Use sudo !! to repeat with sudo
sudo !!Scenario 3 – Clear screen and continue working
# screen is full of output
Ctrl+L
# continue typing new commands6. Quick reference cheat sheet
Ctrl+A– Jump to line start (quickly edit command beginning) Ctrl+E – Jump to line end (append arguments) Ctrl+B – Move left one character (precise cursor positioning) Ctrl+F – Move right one character (precise cursor positioning) Ctrl+U – Delete everything before the cursor (clear current input) Ctrl+K – Delete everything after the cursor (keep only the command prefix) Ctrl+W – Delete the previous word (remove a parameter) Ctrl+Y – Paste the most recently deleted text (recover accidental deletions) Ctrl+R – Search command history (find a past command quickly) !! – Repeat the last command (add sudo, re‑execute) !$ – Last argument of the previous command (avoid re‑typing paths) Ctrl+L – Clear the screen (remove clutter) Ctrl+C – Terminate a running command (force stop) Ctrl+Z – Suspend a command (pause and resume later) Ctrl+D – Exit the shell (quick logout)
7. How to master them quickly
Practice 1–2 shortcuts daily; start with Ctrl+A/E/R and !!.
Print the cheat sheet and stick it near your monitor for quick lookup.
Force yourself to use a shortcut whenever you need to move the cursor instead of the arrow keys.
Build muscle memory – after a week you’ll find the shortcuts indispensable.
Conclusion
Mastering these ten shortcuts can boost your terminal efficiency by more than 50%.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ubuntu
Focused on Ubuntu/Linux tech sharing, offering the latest news, practical tools, beginner tutorials, and problem solutions. Connecting open-source enthusiasts to build a Linux learning community. Join our QQ group or channel for discussion!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
