HomeClaude Code CLIClaude Code Essential Commands
beginner15 min read· Module 4, Lesson 3

⌨️Claude Code Essential Commands

Master the core commands and interactive features

Essential Claude Code Commands

Starting a Session

Terminal
# Start interactive mode in current directory claude # Ask a one-off question claude "explain what this project does" # Start with a specific prompt claude -p "analyze this codebase for security issues"

In-Session Slash Commands

When you're inside a Claude Code session, these commands are available:

CommandWhat It Does
/helpShow available commands
/clearClear conversation history
/compactSummarize conversation to save context
/costShow token usage and cost
/doctorCheck health of your setup
/initCreate a CLAUDE.md for your project
/memoryView saved memories
/reviewReview code changes
/fastToggle fast mode

Common Workflows

Explore a codebase:

Terminal
claude "explain the architecture of this project" claude "what does the main entry point do?" claude "find where user authentication is handled"

Write code:

Terminal
claude "add a login page with email and password fields" claude "write unit tests for the auth module" claude "create a REST API endpoint for user profiles"

Fix bugs:

Terminal
claude "fix the TypeError in src/utils/parser.ts" claude "this test is failing: [paste error]. fix it"

Git operations:

Terminal
claude "commit my changes with a descriptive message" claude "create a new branch called feature/login" claude "open a PR for my current changes"

Piping Data to Claude

Claude Code follows Unix philosophy — you can pipe data into it:

Terminal
# Analyze logs tail -200 app.log | claude -p "find any errors or anomalies" # Review changed files git diff main --name-only | claude -p "review these changes for issues" # Process a file cat data.csv | claude -p "summarize this data"

Non-Interactive Mode

For scripts and automation, use the -p flag (pipe/print mode):

Terminal
# Get a quick answer claude -p "what is the main export of src/index.ts?" # Generate code to stdout claude -p "write a dockerfile for a node app" > Dockerfile

Keyboard Shortcuts

ShortcutAction
EnterSend message
EscapeCancel current generation
Ctrl+CExit Claude Code
TabAccept suggestion
Up ArrowPrevious message

Next up: Learn about CLAUDE.md — the file that teaches Claude about your project.