Getting Started with Claude Code CLI¶
Welcome! This tutorial will get you from zero to your first terminal session with Claude Code CLI.
What You'll Learn¶
- What Claude Code CLI is (and how it differs from web Claude)
- How to install the CLI tool
- How to start your first terminal session
- Understanding the command-line interface
What is Claude Code CLI?¶
Claude Code CLI is a terminal-based AI assistant that runs directly in your command line. This is different from the Claude web interface (claude.ai) - here's why it matters:
| Claude Web | Claude Code CLI |
|---|---|
| Runs in browser | Runs in your terminal |
| Copy/paste code | Direct file access |
| Describe your project | Sees your actual files |
| Chat only | Executes real commands |
| Isolated | Integrated with your tools |
With Claude Code CLI, you can:
- See your files - Read any file in your project directory
- Edit your code - Make changes directly to files on disk
- Run commands - Execute shell commands and see real output
- Search codebases - Find functions, patterns, and dependencies
- Use git - Create commits, branches, and pull requests
Think of it as having a senior developer in your terminal who can actually touch your code.
Installation¶
Prerequisites¶
-
Node.js 18 or higher
-
A terminal - Terminal.app, iTerm2, Windows Terminal, or any shell
-
Authentication - Either:
- Anthropic API key, or
- Claude Pro/Max subscription
Install Claude Code CLI¶
Verify installation:
You should see version output like claude-code v1.x.x.
Your First Terminal Session¶
Starting the CLI¶
Open your terminal (Terminal.app, iTerm2, Windows Terminal, etc.) and type:
The first time you run this, you'll be prompted to authenticate. Follow the on-screen instructions in your terminal.
The Terminal Interface¶
Once started, you'll see something like this in your terminal:
╭─────────────────────────────────────────╮
│ Claude Code │
│ Working directory: /your/current/path │
╰─────────────────────────────────────────╯
>
The > is your input prompt. Type your message and press Enter. All interaction happens right here in the terminal - no browser needed.
Your First Conversation¶
Try these starter prompts:
Claude will look at your current folder and describe what's there.
Claude will create the file for you. Check your directory - it's really there!
Claude will execute the file and show you the output.
Exiting¶
To end your session:
- Type /exit or
- Press Ctrl+C twice
Key Concepts¶
The Working Directory¶
Claude Code CLI operates in whatever directory you started it from in your terminal. It can see and modify files in that directory and its subdirectories - just like any other CLI tool.
This is why Claude Code CLI is powerful - it has the same file access as you do in that terminal session.
Conversations Have Memory¶
Within a terminal session, Claude remembers what you've discussed. You can say things like: - "Actually, change that function to..." - "Add error handling to what you just wrote" - "Undo that last change"
Tool Permissions¶
Claude Code CLI asks permission in the terminal before taking certain actions: - Creating or modifying files - Running shell commands - Accessing the network
You'll see prompts like:
Type y and press Enter to approve, or n to deny.
Try It Yourself¶
Exercise 1: Hello Claude¶
-
Create a new directory:
-
Start Claude Code:
-
Ask Claude to:
- Create a Python file that prints your name
- Run the file
-
Modify it to also print today's date
-
Exit Claude Code and verify the file exists:
Common Issues¶
"command not found: claude"¶
npm's global bin directory isn't in your PATH. Try:
# Find where npm installs global packages
npm config get prefix
# Add to your PATH (in ~/.bashrc or ~/.zshrc)
export PATH="$PATH:$(npm config get prefix)/bin"
Authentication Failed¶
Make sure you've either:
- Set the ANTHROPIC_API_KEY environment variable, or
- Completed the login flow for Claude Pro/Max
Permission Denied¶
If you see permission errors during install:
What's Next?¶
Now that you can start Claude Code CLI and have a conversation in your terminal, let's learn the essential commands in 02-basic-commands.
Summary:
- Claude Code CLI is a terminal-based AI assistant (different from claude.ai web)
- Install with npm install -g @anthropic-ai/claude-code
- Start with claude command, exit with /exit or Ctrl+C
- It works in your current directory and has real file/command access
- All interaction happens in the terminal - no browser needed
Learning Resources¶
Featured Video¶
NetworkChuck: AI in the Terminal (3.6M subscribers, 500K+ views)
Comprehensive tutorial covering Claude Code installation, setup, and first steps. Perfect for beginners learning AI coding assistants from the command line. Includes Gemini CLI and ChatGPT comparisons.
Additional Resources¶
| Type | Resource | Description |
|---|---|---|
| 🎬 Video | Claude Code Beginners Guide 2025 | All About AI - Complete walkthrough for beginners |
| 📚 Official Docs | Claude Code Getting Started | Anthropic's official documentation |
| 📖 Tutorial | DataCamp Claude Code Tutorial | Hands-on guide with practical examples |
| 🎓 Free Course | Anthropic Academy | Official free courses with certificates |
| 💼 Commercial | Complete AI Coding Course 2025 | Udemy - Cursor, Claude Code comprehensive |