Guilds AI / Blog

,

How to Use Claude Code in Terminal: A Beginner’s Guide

Laptop displaying an illustrative Claude Code terminal session with a code refactoring request.

To use Claude Code in terminal, install the command-line interface, open the project you want to work on, and run claude. Sign in, describe a small task, inspect the proposed changes, and verify the result with tests. This guide covers the first session on macOS, Linux and Windows, including common commands and troubleshooting. If you are deciding whether a terminal agent is necessary, our Claude Code vs Claude Chat comparison explains the distinction between conversational and repository-based work.

For the separately billed developer API authentication method, see our Claude API keys guide.

If a session stops with an internal server error, follow our Claude Code 500 error troubleshooting guide.

If you prefer a graphical interface in your editor rather than the shell, see our Claude Code in VS Code guide.

If you intend to authenticate with separately billed API access, see our guide to using Claude Code with an API key.

For clipboard shortcuts and file paths in the interactive terminal, read our guide to pasting images into Claude Code.

To request Codex reviews without leaving your Claude Code session, see our Claude Code Codex plugin guide.

For a structured practice schedule after your first terminal session, see our Claude Code learning path.

If you are choosing between a repository-focused agent and an integrated cloud app builder, our Replit vs Claude Code comparison explains the workflow and hosting differences.

What you need to use Claude Code in your terminal

Claude Code is Anthropic’s coding agent. Its command-line interface accepts natural-language requests and can inspect files, make edits, and run development commands within the access it receives. You need a terminal, a supported Claude subscription, Console account or approved cloud provider, and a project you are authorized to access. Start with a small repository that contains no production secrets. Git is helpful for reviewing and recovering changes.

Step 1: Install Claude Code

Anthropic documents native installation for macOS, Linux, WSL and Windows. The following package-manager commands are alternatives to the native installer. Use the command for your operating system, not both. On macOS with Homebrew:

brew install --cask claude-code

On Windows with WinGet:

winget install Anthropic.ClaudeCode

For Linux, the official native installer is available at claude.ai/install.sh. Anthropic documents this shell command; it downloads and executes a script. Check the official source and review the script before running it.

curl -fsSL https://claude.ai/install.sh | bash

Native installation does not require Node.js. On native Windows, Git for Windows is optional and provides Bash support. WSL users install inside their Linux distribution. Package-manager installations need periodic updates through the corresponding package manager.

Open a new terminal and check that the CLI is available:

claude --version

The installation instructions were checked against the official quickstart and setup documentation. Guilds AI did not execute the installer or test an authenticated Claude Code session for this guide.

Step 2: Launch Claude Code and sign in

Navigate to the project directory. Replace the example path with the location of your own repository.

cd "/path/to/your/project"
git status
claude

If you are not working in a Git repository, omit git status. The claude command opens the interactive session. On the first launch, follow the authentication prompts using your approved account. A subscription and Console API billing are different access arrangements, so check which one you are using before authorizing requests.

Review any workspace trust prompt carefully. Only trust repositories whose contents and scripts you understand. A version number alone does not confirm authentication or model access. Once signed in, enter a simple request to verify that the session responds.

Step 3: Give Claude Code its first task

Begin with a read-only exploration rather than requesting a broad rewrite. For a small Python repository, you could enter the following request at the Claude Code prompt, not directly into your shell:

Explain the project structure and locate the function that validates order quantities. Identify the relevant tests. Do not edit files or run commands yet.

After checking the explanation against the files, define a narrow change:

Fix the quantity validation so zero and negative quantities are rejected. Add tests for these two cases. Keep unrelated files unchanged. Explain the proposed changes before editing.

This is a hypothetical example, not a recorded Claude Code session. Inspect the proposed operations and their permissions. If the task requires installing a dependency, accessing another system, or changing a broader part of the repository, decide whether that is necessary before granting access. See our AI coding agents guide for safe delegation.

Step 4: Review changes and run tests

Do not assume the task is complete merely because Claude reports success. Open another terminal in the same project and inspect the changes:

git status --short
git diff

For a Python project using pytest, run its existing test command, such as python -m pytest, in the configured environment. Use the actual project’s documented test command instead if it differs. Review newly created files as well as changes to tracked files, because git diff alone does not show untracked files.

Check that the requested behavior works, unrelated functionality remains unchanged, and no credentials or unnecessary dependencies have been introduced. Keep version-control commits and deployment decisions under your normal review process.

Useful terminal commands and shortcuts

Commands entered in your operating-system shell start or resume Claude Code. Slash commands entered within an active Claude Code session control that session. Do not confuse the two.

CommandWhere to enter itPurpose
claudeShellStart an interactive session
claude –continueShellReturn to the most recent conversation in the project
claude –resumeShellChoose a previous conversation
claude doctorShellDiagnose installation and configuration
/helpSessionSee available commands
/permissionsSessionInspect permission rules
/clearSessionStart fresh conversation context
/usageSessionInspect usage information

To paste text into Claude Code terminal input, use your terminal’s normal paste shortcut: typically Command-V on macOS, Ctrl-Shift-V in many Linux terminals, and Ctrl-V in Windows Terminal. Shortcuts vary by terminal. Review multiline input before submitting it, and remove passwords, tokens and sensitive logs. To add project-level preferences or approval rules, use our Claude Code settings guide.

Troubleshoot common terminal problems

If claude is not recognized, restart the terminal and check whether the install directory is on PATH. Use claude doctor for further diagnosis once the executable is available. If a login fails, confirm account eligibility and network connectivity, and follow the official sign-in flow rather than entering credentials into prompts.

If Claude appears to be working in the wrong project, exit and relaunch from the intended directory. If a command requires approval, inspect the matching permission and the intended effect; do not disable protections merely to bypass an interruption. If an error persists, share the sanitized error text and relevant versions with support.

You can also run the separately installed CLI from an editor’s integrated terminal, provided that terminal can find the executable. The CLI is different from a graphical editor extension.

Frequently asked questions

How do I activate Claude Code in terminal? Install the CLI, open your project directory, run claude and authenticate with an eligible account.

How do I return to a previous conversation? From the project directory, run claude –continue for the most recent session or claude –resume to select one.

Does Claude Code work on Windows? Yes. Anthropic supports native Windows and WSL installation. Choose the option that fits your project’s toolchain.

Can Claude Code run without permission prompts? Available permission modes depend on your version and configuration. Review access and use appropriate restrictions rather than assuming all operations are safe.

Is Claude Code free to use? Downloading the CLI does not itself provide model access. You need an eligible subscription, billing account or approved provider.