Cursor Navigation
Moving Around
| Shortcut |
Action |
| Ctrl + A |
Move to beginning of line |
| Ctrl + E |
Move to end of line |
| Ctrl + F |
Move forward one character |
| Ctrl + B |
Move backward one character |
| Alt + F |
Move forward one word |
| Alt + B |
Move backward one word |
| Ctrl + XX |
Toggle between start of line and current position |
Quick Tips
# Use arrow keys + Ctrl for word jumping
Ctrl + → (Right Arrow) # Move forward one word
Ctrl + ← (Left Arrow) # Move backward one word
Text Editing
Deleting Text
| Shortcut |
Action |
| Ctrl + D |
Delete character under cursor |
| Ctrl + H |
Delete character before cursor (backspace) |
| Ctrl + W |
Delete word before cursor |
| Alt + D |
Delete word after cursor |
| Ctrl + K |
Delete from cursor to end of line |
| Ctrl + U |
Delete from cursor to beginning of line |
Cut, Copy, Paste
| Shortcut |
Action |
| Ctrl + Y |
Paste (yank) last deleted text |
| Alt + Y |
Cycle through kill ring (previous yanks) |
| Ctrl + K |
Cut from cursor to end of line |
| Ctrl + U |
Cut from cursor to start of line |
Modifying Text
| Shortcut |
Action |
| Ctrl + T |
Swap current character with previous |
| Alt + T |
Swap current word with previous |
| Alt + U |
Uppercase word from cursor |
| Alt + L |
Lowercase word from cursor |
| Alt + C |
Capitalize word from cursor |
| Ctrl + _ |
Undo last edit |
Command History
Navigation
| Shortcut |
Action |
| ↑ / Ctrl + P |
Previous command |
| ↓ / Ctrl + N |
Next command |
| Ctrl + R |
Reverse search history |
| Ctrl + S |
Forward search history |
| Ctrl + G |
Cancel history search |
| Alt + . |
Insert last argument of previous command |
History Expansion
# Execute last command
!!
# Execute command N in history
!N
# Execute last command starting with 'git'
!git
# Execute last command containing 'commit'
!?commit?
# Use arguments from last command
echo hello world
echo !!:* # Uses "hello world"
echo !!:1 # Uses "hello"
echo !!:2 # Uses "world"
echo !!:$ # Uses last argument "world"
# Replace in last command
^old^new # Replace 'old' with 'new' and execute
History Commands
# View history
history
# View last 20 commands
history 20
# Clear history
history -c
# Search history
history | grep "pattern"
# Execute command from history
!42 # Execute command #42
Process Control
| Shortcut |
Action |
| Ctrl + C |
Interrupt (kill) current process |
| Ctrl + Z |
Suspend current process |
| Ctrl + D |
Exit shell (or send EOF) |
| Ctrl + L |
Clear screen |
Job Control
# Run in background
command &
# List background jobs
jobs
# Bring job to foreground
fg %1
# Send job to background
bg %1
# Kill job
kill %1
Screen Control
| Shortcut |
Action |
| Ctrl + L |
Clear screen (keep current line) |
| Ctrl + S |
Stop screen output |
| Ctrl + Q |
Resume screen output |
Terminal Commands
# Clear screen
clear
# Reset terminal
reset
# Clear scrollback
clear && printf '\e[3J'
Command Line Tricks
Auto-completion
| Shortcut |
Action |
| Tab |
Auto-complete command/filename |
| Tab Tab |
Show all completions |
| Alt + ? |
Show completions |
| Alt + * |
Insert all completions |
Quick Substitution
# Repeat last command
!!
# Repeat with sudo
sudo !!
# Change directory back
cd -
# Refer to home directory
cd ~
cd ~/projects
# Refer to previous directory
cd ~-
Brace Expansion
# Create multiple files
touch file{1,2,3}.txt
# Creates: file1.txt file2.txt file3.txt
# Create sequence
mkdir day{01..31}
# Creates: day01, day02, ..., day31
# Multiple extensions
cp file.{txt,bak}
# Same as: cp file.txt file.bak
# Nested braces
echo {a,b}{1,2}
# Output: a1 a2 b1 b2
Zsh-Specific Shortcuts
Enhanced Features
| Shortcut |
Action |
| Ctrl + R |
Fuzzy history search (with fzf) |
| Tab |
Smart completion with menu |
| Alt + Enter |
Insert newline (multi-line command) |
Directory Navigation
# Quick directory changes (zsh)
cd ... # Go up 2 directories
cd .... # Go up 3 directories
# Directory stack
pushd /path # Push directory to stack
popd # Pop and go to previous
dirs -v # List directory stack
# Auto cd (if enabled)
/path/to/dir # Same as: cd /path/to/dir
Useful Aliases
Add to ~/.bashrc or ~/.zshrc:
# Navigation
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias ~='cd ~'
alias -- -='cd -'
# Listing
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias lt='ls -ltr' # Sort by time
# Safety
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Shortcuts
alias h='history'
alias c='clear'
alias e='exit'
alias v='vim'
# Git
alias g='git'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gl='git log --oneline'
# Docker
alias d='docker'
alias dc='docker-compose'
alias dps='docker ps'
Quick Reference Card
Essential Shortcuts
| Category |
Shortcut |
Action |
| Navigate |
Ctrl+A |
Start of line |
| |
Ctrl+E |
End of line |
| |
Alt+F/B |
Word forward/back |
| Edit |
Ctrl+W |
Delete word |
| |
Ctrl+K |
Delete to end |
| |
Ctrl+U |
Delete to start |
| |
Ctrl+Y |
Paste deleted |
| History |
Ctrl+R |
Search history |
| |
↑/↓ |
Navigate history |
| |
!! |
Last command |
| Control |
Ctrl+C |
Kill process |
| |
Ctrl+Z |
Suspend process |
| |
Ctrl+L |
Clear screen |
| |
Ctrl+D |
Exit shell |
Resources