Learn about Claude Code, an agentic coding tool made by Anthropic. Currently in beta as a research preview.
sudo npm install -g
as this can lead to permission issues and
security risks. If you encounter permission errors, see configure Claude
Code for recommended solutions./bug
command or through our GitHub repository.npm
. Try:
npm config set os linux
before installationnpm install -g @anthropic-ai/claude-code --force --no-os-check
(Do NOT use sudo
)exec: node: not found
when running claude
, your WSL environment may be using a Windows installation of Node.js. You can confirm this with which npm
and which node
, which should point to Linux paths starting with /usr/
rather than /mnt/c/
. To fix this, try installing Node via your Linux distribution’s package manager or via nvm
.
Install Claude Code
npm install -g @anthropic-ai/claude-code
sudo npm install -g
as this can lead to permission issues and
security risks. If you encounter permission errors, see configure Claude
Code for recommended solutions.Navigate to your project
cd your-project-directory
Start Claude Code
claude
to launchComplete authentication
claude
summarize this project
/init
--print
(-p
) to run Claude in non-interactive mode. In this mode, you can set the ANTHROPIC_API_KEY
environment variable to provide a custom API key.
Non-interactive mode is especially useful when you pre-configure the set of commands Claude is allowed to use:
Command | Description | Example |
---|---|---|
claude | Start interactive REPL | claude |
claude "query" | Start REPL with initial prompt | claude "explain this project" |
claude -p "query" | Run one-off query, then exit | claude -p "explain this function" |
cat file | claude -p "query" | Process piped content | cat logs.txt | claude -p "explain" |
claude config | Configure settings | claude config set --global theme dark |
claude update | Update to latest version | claude update |
claude mcp | Configure Model Context Protocol servers | See MCP section in tutorials |
--print
(-p
): Print response without interactive mode--json
: Return JSON output in --print
mode, useful for scripting and automation--verbose
: Enable verbose logging, shows full turn-by-turn output (helpful for debugging in both print and interactive modes)--dangerously-skip-permissions
: Skip permission promptsCommand | Purpose |
---|---|
/bug | Report bugs (sends conversation to Anthropic) |
/clear | Clear conversation history |
/compact [instructions] | Compact conversation with optional focus instructions |
/config | View/modify configuration |
/cost | Show token usage statistics |
/doctor | Checks the health of your Claude Code installation |
/help | Get usage help |
/init | Initialize project with CLAUDE.md guide |
/login | Switch Anthropic accounts |
/logout | Sign out from your Anthropic account |
/memory | Edit CLAUDE.md memory files |
/pr_comments | View pull request comments |
/review | Request code review |
/terminal-setup | Install Shift+Enter key binding for newlines (iTerm2 and VSCode only) |
/vim | Enter vim mode for alternating insert and command modes |
Memory Type | Location | Purpose | Use Case Examples |
---|---|---|---|
Project memory | ./CLAUDE.md | Team-shared conventions and knowledge | Project architecture, coding standards, common workflows |
Project memory (local) | ./CLAUDE.local.md | Personal project-specific preferences | Your sandbox URLs, preferred test data |
User memory | ~/.claude/CLAUDE.md | Global personal preferences | Code styling preferences, personal tooling shortcuts |
#
shortcut#
character:
/memory
/memory
slash command during a session to open any memory file in your system editor for more extensive additions or organization.
Tool Type | Example | Approval Required | ”Yes, don’t ask again” Behavior |
---|---|---|---|
Read-only | File reads, LS, Grep | No | N/A |
Bash Commands | Shell execution | Yes | Permanently per project directory and command |
File Modification | Edit/write files | Yes | Until session end |
Tool | Description | Permission Required |
---|---|---|
Agent | Runs a sub-agent to handle complex, multi-step tasks | No |
Bash | Executes shell commands in your environment | Yes |
Glob | Finds files based on pattern matching | No |
Grep | Searches for patterns in file contents | No |
LS | Lists files and directories | No |
Read | Reads the contents of files | No |
Edit | Makes targeted edits to specific files | Yes |
Write | Creates or overwrites files | Yes |
NotebookEdit | Modifies Jupyter notebook cells | Yes |
NotebookRead | Reads and displays Jupyter notebook contents | No |
WebFetch | Fetches content from a specified URL | Yes |
/allowed-tools
or in
permission settings.
curl
and wget
/bug
Variable | Purpose |
---|---|
DISABLE_AUTOUPDATER | Set to 1 to disable the automatic updater |
DISABLE_BUG_COMMAND | Set to 1 to disable the /bug command |
DISABLE_COST_WARNINGS | Set to 1 to disable cost warning messages |
DISABLE_ERROR_REPORTING | Set to 1 to opt out of Sentry error reporting |
DISABLE_TELEMETRY | Set to 1 to opt out of Statsig telemetry (note that Statsig events do not include user data like code, file paths, or bash commands) |
HTTP_PROXY | Specify HTTP proxy server for network connections |
HTTPS_PROXY | Specify HTTPS proxy server for network connections |
MCP_TIMEOUT | Timeout in milliseconds for MCP server startup |
MCP_TOOL_TIMEOUT | Timeout in milliseconds for MCP tool execution |
claude config
in your terminal, or the /config
command when using the interactive REPL.
claude config list
claude config get <key>
claude config set <key> <value>
claude config add <key> <value>
claude config remove <key> <value>
config
changes your project configuration. To manage your global configuration, use the --global
(or -g
) flag.
claude config set -g <key> <value>
:
Key | Value | Description |
---|---|---|
autoUpdaterStatus | disabled or enabled | Enable or disable the auto-updater (default: enabled ) |
env | JSON (eg. '{"FOO": "bar"}' ) | Environment variables that will be applied to every session |
preferredNotifChannel | iterm2 , iterm2_with_bell , terminal_bell , or notifications_disabled | Where you want to receive notifications (default: iterm2 ) |
theme | dark , light , light-daltonized , or dark-daltonized | Color theme |
verbose | true or false | Whether to show full bash and command outputs (default: false ) |
claude config set <key> <value>
(without the -g
flag):
Key | Value | Description |
---|---|---|
allowedTools | array of tools | Which tools can run without manual approval |
ignorePatterns | array of glob strings | Which files/directories are ignored when using tools |
allowedTools
rule format.
/config
command
\
followed by Enter to create a newline/terminal-setup
within Claude Code to automatically configure Shift+Enter as a more intuitive alternative.
/vim
or configured via /config
.
The supported subset includes:
Esc
(to NORMAL), i
/I
, a
/A
, o
/O
(to INSERT)h
/j
/k
/l
, w
/e
/b
, 0
/$
/^
, gg
/G
x
, dw
/de
/db
/dd
/D
, cw
/ce
/cb
/cc
/C
, .
(repeat)/cost
to see current session usage/config
and navigate to “Auto-compact enabled”
/compact
manually when context gets large
/compact Focus on code samples and API usage
/clear
to reset context
claude-opus-4-20250514
. You can override this using the following environment variables:
ANTHROPIC_BEDROCK_BASE_URL
environment variable:
~/.aws/credentials
or relevant environment variables like AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
). To set up AWS credentials, run:
ANTHROPIC_VERTEX_BASE_URL
environment variable:
us-east5
region. Make
sure your project has quota allocated in this specific region.ANTHROPIC_AUTH_TOKEN
: Custom value for the Authorization
and Proxy-Authorization
headers (the value you set here will be prefixed with Bearer
)ANTHROPIC_CUSTOM_HEADERS
: Custom headers you want to add to the request (in Name: Value
format)HTTP_PROXY
: Set the HTTP proxy URLHTTPS_PROXY
: Set the HTTPS proxy URLenv
object in your global Claude config (in ~/.claude.json).
apiKeyHelper
: A custom shell script to get an API key (invoked once at startup, and cached for the duration of each session)claude --dangerously-skip-permissions
to bypass permission prompts for unattended operation. We’ve included a reference implementation that you can customize for your needs.