Keyboard Shortcuts in the Linux Terminal
Command Editing Shortcuts
Shortcut | Description |
---|---|
Ctrl + A | Move the cursor to the start of the line |
Ctrl + E | Move the cursor to the end of the line |
Ctrl + U | Cut (delete) everything from cursor to beginning of line |
Ctrl + K | Cut (delete) everything from cursor to end of line |
Ctrl + W | Cut (delete) the word before the cursor |
Alt + D | Delete the word after the cursor |
Ctrl + Y | Paste the last cut text (yank) |
Ctrl + L | Clear the screen (similar to clear command) |
Ctrl + T | Swap the last two characters before the cursor |
Alt + . | Insert the last argument from the previous command |
Cursor Movement
Shortcut | Description |
---|---|
Ctrl + F | Move cursor forward by one character |
Ctrl + B | Move cursor backward by one character |
Alt + F | Move forward one word |
Alt + B | Move backward one word |
Command History Navigation
Shortcut | Description |
---|---|
Ctrl + R | Reverse search through command history |
Ctrl + G | Exit search mode |
Up / Down | Browse through previous/next commands in history |
Ctrl + P / N | Same as Up/Down arrows (Previous/Next) |
!! | Run the last command again |
!abc | Run the last command that starts with abc |
Job Control and Terminal Control
Shortcut | Description |
---|---|
Ctrl + C | Terminate the running command/process |
Ctrl + Z | Suspend the current foreground job |
jobs | Show background and suspended jobs |
fg | Bring suspended job to foreground |
bg | Resume job in background |
Ctrl + D | Log out of terminal / send EOF (End Of File) |
Ctrl + S | Stop all output to the screen (XON/XOFF flow control) |
Ctrl + Q | Resume output to the screen |
Tab Completion & Re-execution
Shortcut | Description |
---|---|
Tab | Auto-complete commands, paths, files |
Tab Tab | Show all possible completions (if ambiguity) |
!! | Re-run the previous command |
!n | Run command number n from history |
Screen and Terminal Multiplexers (Bonus)
If you use tmux or screen, you can detach sessions, switch between panes, etc., but that’s a deeper topic. Ask if you’d like to explore that too.
Summary Table
Task | Shortcut |
---|---|
Move to start/end of line | Ctrl + A / Ctrl + E |
Clear screen | Ctrl + L |
Cut word/back to start | Ctrl + W / Ctrl + U |
Reverse search | Ctrl + R |
Terminate/suspend process | Ctrl + C / Ctrl + Z |
Paste yanked text | Ctrl + Y |
Search history | Up / Down or Ctrl + P/N |
Auto-complete | Tab |
EOF/Exit | Ctrl + D |
Last updated on