Skip to the content.

Claude

Claude CLI

Claude CLI is a powerful command-line interface tool that allows developers to interact with Anthropic’s Claude models directly from their terminal. It supports various tasks, including code generation, analysis, and execution.

Installation

Linux

curl -L https://github.com/anthropic-ai/claude-code/releases/latest/download/claude-linux -o /usr/local/bin/claude
chmod +x /usr/local/bin/claude

macOS

curl -L https://github.com/anthropic-ai/claude-code/releases/latest/download/claude-macos -o /usr/local/bin/claude
chmod +x /usr/local/bin/claude

Configuration

To use Claude CLI, you need an Anthropic API key. You can obtain one from the Anthropic Console.

Set the API key as an environment variable:

export ANTHROPIC_API_KEY=sk-ant-XXXXXXXXXXXXXXXX

You can also store your credentials in ~/.claude/.credentials.json.

Usage, tips and tricks

Claude CLI can be used for a variety of tasks. Here is a basic example:

# From ~/.claude/.credentials.json
export ANTHROPIC_API_KEY=sk-ant-XXXXXXXXXXXXXXXX

claude --dangerously-skip-permissions "Start executing newly written tasklist TASKLIST.md"

Coding tips and tricks

Passing a logged-in session to another machine

The cleanest way is a long-lived token, generated once on the machine where you are logged in:

claude setup-token

On the target machine export it, no second login is needed:

export CLAUDE_CODE_OAUTH_TOKEN=...
claude -p "prompt" --dangerously-skip-permissions

Alternatives: copy ~/.claude/.credentials.json to the same path on the target machine, or use an API key via ANTHROPIC_API_KEY.

For a CLI executor such as Argo Workflows or Dagu, a pre step exports the token into the process environment, then starts the agent, for example through smi-agent. Distributing the secret itself is planned later through a secret tool such as OpenBao: the pre step reads the current token from there.

See also