Appearance
Tricks & Shortcuts
| Shortcut | Action |
|---|---|
Ctrl + C | Cancel current command |
Ctrl + L | Clear screen (same as clear) |
Ctrl + A | Move cursor to start of line |
Ctrl + E | Move cursor to end of line |
Opt + Left/Right | Move cursor word by word |
Tab | Auto-complete file/folder names |
Up Arrow | Previous command |
Ctrl + R | Search command history |
Helpful Tricks
Command History
- Press
Up Arrowto cycle through previous commands - Type
historyto see all recent commands - Press
Ctrl + Rand start typing to search history
Chaining Commands
bash
# Run two commands in sequence
mkdir my-project && cd my-project
# Run second command only if first succeeds
brew update && brew upgradePiping Output
Send the output of one command into another:
bash
# Count files in a directory
ls | wc -l
# Search for a word in command output
history | grep "brew"Aliases
Create shortcuts for long commands. Add to ~/.zshrc:
bash
# Open .zshrc to edit
nano ~/.zshrc
# Add aliases like these:
alias ll="ls -la"
alias gs="git status"
alias brewup="brew update && brew upgrade && brew cleanup"
# Save (Ctrl+O, Enter) and exit (Ctrl+X)
# Reload:
source ~/.zshrc