β¨οΈ Essential Terminal Shortcuts Cheat Sheet
Master the command line with these essential keyboard shortcuts for macOS Terminal, Linux shells (Bash/Zsh), and Windows PowerShell/Command Prompt.
π Quick Reference Card
| Action |
macOS/Linux |
Windows PowerShell |
| Clear screen |
Ctrl + L |
Ctrl + L or cls |
| Cancel command |
Ctrl + C |
Ctrl + C |
| Exit terminal |
Ctrl + D |
exit |
| Previous command |
β or Ctrl + P |
β |
| Search history |
Ctrl + R |
Ctrl + R |
π macOS & Linux Terminal Shortcuts
Navigation Shortcuts
| Shortcut |
Action |
Description |
Ctrl + A |
Beginning of line |
Move cursor to start of command |
Ctrl + E |
End of line |
Move cursor to end of command |
Ctrl + B |
Back one character |
Move left (same as β arrow) |
Ctrl + F |
Forward one character |
Move right (same as β arrow) |
Alt + B |
Back one word |
Jump to previous word |
Alt + F |
Forward one word |
Jump to next word |
Ctrl + XX |
Toggle position |
Switch between cursor and start |
Editing Shortcuts
| Shortcut |
Action |
Description |
Ctrl + U |
Cut to beginning |
Delete from cursor to line start |
Ctrl + K |
Cut to end |
Delete from cursor to line end |
Ctrl + W |
Cut word before |
Delete word before cursor |
Alt + D |
Cut word after |
Delete word after cursor |
Ctrl + Y |
Paste (yank) |
Paste last cut text |
Ctrl + T |
Transpose characters |
Swap character with previous |
Alt + T |
Transpose words |
Swap word with previous |
Alt + U |
Uppercase word |
Convert word to UPPERCASE |
Alt + L |
Lowercase word |
Convert word to lowercase |
Alt + C |
Capitalize word |
Capitalize first letter |
History Shortcuts
| Shortcut |
Action |
Description |
Ctrl + R |
Reverse search |
Search command history backwards |
Ctrl + S |
Forward search |
Search command history forwards |
Ctrl + G |
Exit search |
Cancel history search |
Ctrl + P |
Previous command |
Go to previous history entry |
Ctrl + N |
Next command |
Go to next history entry |
!! |
Repeat last |
Execute last command |
!$ |
Last argument |
Use last argument of previous command |
!* |
All arguments |
Use all arguments of previous command |
!string |
History match |
Run last command starting with βstringβ |
Screen Control
| Shortcut |
Action |
Description |
Ctrl + L |
Clear screen |
Clear terminal (preserves current line) |
Ctrl + S |
Pause output |
Freeze terminal output |
Ctrl + Q |
Resume output |
Unfreeze terminal output |
Process Control
| Shortcut |
Action |
Description |
Ctrl + C |
Cancel/Interrupt |
Stop current command |
Ctrl + Z |
Suspend |
Suspend current process (use fg to resume) |
Ctrl + D |
Exit/EOF |
Exit shell or send end-of-file |
πͺ Windows PowerShell Shortcuts
Navigation Shortcuts
| Shortcut |
Action |
Description |
Home |
Beginning of line |
Move cursor to start |
End |
End of line |
Move cursor to end |
Ctrl + β |
Back one word |
Jump to previous word |
Ctrl + β |
Forward one word |
Jump to next word |
Editing Shortcuts
| Shortcut |
Action |
Description |
Ctrl + Backspace |
Delete word before |
Delete word before cursor |
Ctrl + Delete |
Delete word after |
Delete word after cursor |
Escape |
Clear line |
Clear current input line |
Insert |
Toggle insert mode |
Switch between insert/overwrite |
History Shortcuts
| Shortcut |
Action |
Description |
β / β |
Browse history |
Navigate through command history |
Ctrl + R |
Reverse search |
Search history (PSReadLine) |
F7 |
History window |
Show command history popup |
F8 |
Search history |
Search history by prefix |
F9 |
Run by number |
Run command by history number |
Screen Control
| Shortcut |
Action |
Description |
Ctrl + L |
Clear screen |
Clear terminal screen |
Ctrl + Home |
Clear scroll |
Clear scrollback buffer |
π₯ Power User Tips
Bash/Zsh Bang Commands
# Repeat last command
!!
# Repeat with sudo
sudo !!
# Last argument of previous command
cd !$
# All arguments of previous command
echo !*
# Run command #42 from history
!42
# Run last command starting with "git"
!git
# Run last command containing "docker"
!?docker?
History Expansion
# Show history with line numbers
history
# Show last 10 commands
history 10
# Execute command by number
!123
# Replace and execute
^old^new^ # Replace 'old' with 'new' in last command
Directory Navigation Shortcuts
# Go to home directory
cd ~
cd
# Go to previous directory
cd -
# Go up one level
cd ..
# Go up multiple levels
cd ../..
cd ../../..
# Push/Pop directories (Bash/Zsh)
pushd /some/path
popd
macOS Terminal
- Option key: Use
Option instead of Alt for word navigation
- Terminal app settings: Enable βUse Option as Meta keyβ in Preferences β Profiles β Keyboard
- iTerm2 users: Most shortcuts work the same, with additional customization options
Linux (Bash/Zsh)
- Alt key shortcuts: May require terminal emulator configuration
- Zsh users: Many shortcuts are the same, with additional Zsh-specific features
- Tmux/Screen users: Prefix key may intercept some shortcuts
Windows PowerShell
- PSReadLine module: Enables Bash-like shortcuts in PowerShell
- Windows Terminal: Supports more shortcuts than legacy CMD
- Install PSReadLine:
Install-Module PSReadLine -Force
π Additional Resources
Learn More
π¨οΈ Printable Cheat Sheet
Download the printable PDF version: [Coming Soon]
Pro tip: Print this cheat sheet and keep it next to your keyboard until these shortcuts become muscle memory!
| Last Updated: December 2025 |
Author: IT-Journey Team |
Found this helpful? Share it with fellow developers! π