前提: 需要用梯子

官网 : https://claude.com/product/claude-code

安装

curl -fsSL https://claude.ai/install.sh | bash
claude --help
Usage: claude [options] [command] [prompt]

Claude Code - starts an interactive session by default, use -p/--print for
non-interactive output

Arguments:
  prompt                                            Your prompt

Options:
  --add-dir <directories...>                        Additional directories to allow tool access to
  --agent <agent>                                   Agent for the current session. Overrides the 'agent' setting.
  --agents <json>                                   JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')
  --allow-dangerously-skip-permissions              Enable bypassing all permission checks as an option, without it being enabled by default. Recommended only for sandboxes with no internet access.
  --allowedTools, --allowed-tools <tools...>        Comma or space-separated list of tool names to allow (e.g. "Bash(git:*) Edit")
  --append-system-prompt <prompt>                   Append a system prompt to the default system prompt
  --betas <betas...>                                Beta headers to include in API requests (API key users only)
  --chrome                                          Enable Claude in Chrome integration
  -c, --continue                                    Continue the most recent conversation in the current directory
  --dangerously-skip-permissions                    Bypass all permission checks. Recommended only for sandboxes with no internet access.
  -d, --debug [filter]                              Enable debug mode with optional category filtering (e.g., "api,hooks" or "!1p,!file")
  --debug-file <path>                               Write debug logs to a specific file path (implicitly enables debug mode)
  --disable-slash-commands                          Disable all skills
  --disallowedTools, --disallowed-tools <tools...>  Comma or space-separated list of tool names to deny (e.g. "Bash(git:*) Edit")
  --effort <level>                                  Effort level for the current session (low, medium, high)
  --fallback-model <model>                          Enable automatic fallback to specified model when default model is overloaded (only works with --print)
  --file <specs...>                                 File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)
  --fork-session                                    When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)
  --from-pr [value]                                 Resume a session linked to a PR by PR number/URL, or open interactive picker with optional search term
  -h, --help                                        Display help for command
  --ide                                             Automatically connect to IDE on startup if exactly one valid IDE is available
  --include-partial-messages                        Include partial message chunks as they arrive (only works with --print and --output-format=stream-json)
  --input-format <format>                           Input format (only works with --print): "text" (default), or "stream-json" (realtime streaming input) (choices: "text", "stream-json")
  --json-schema <schema>                            JSON Schema for structured output validation. Example: {"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}
  --max-budget-usd <amount>                         Maximum dollar amount to spend on API calls (only works with --print)
  --mcp-config <configs...>                         Load MCP servers from JSON files or strings (space-separated)
  --mcp-debug                                       [DEPRECATED. Use --debug instead] Enable MCP debug mode (shows MCP server errors)
  --model <model>                                   Model for the current session. Provide an alias for the latest model (e.g. 'sonnet' or 'opus') or a model's full name (e.g. 'claude-sonnet-4-6').
  --no-chrome                                       Disable Claude in Chrome integration
  --no-session-persistence                          Disable session persistence - sessions will not be saved to disk and cannot be resumed (only works with --print)
  --output-format <format>                          Output format (only works with --print): "text" (default), "json" (single result), or "stream-json" (realtime streaming) (choices: "text", "json", "stream-json")
  --permission-mode <mode>                          Permission mode to use for the session (choices: "acceptEdits", "bypassPermissions", "default", "dontAsk", "plan")
  --plugin-dir <paths...>                           Load plugins from directories for this session only (repeatable)
  -p, --print                                       Print response and exit (useful for pipes). Note: The workspace trust dialog is skipped when Claude is run with the -p mode. Only use this flag in directories you trust.
  --replay-user-messages                            Re-emit user messages from stdin back on stdout for acknowledgment (only works with --input-format=stream-json and --output-format=stream-json)
  -r, --resume [value]                              Resume a conversation by session ID, or open interactive picker with optional search term
  --session-id <uuid>                               Use a specific session ID for the conversation (must be a valid UUID)
  --setting-sources <sources>                       Comma-separated list of setting sources to load (user, project, local).
  --settings <file-or-json>                         Path to a settings JSON file or a JSON string to load additional settings from
  --strict-mcp-config                               Only use MCP servers from --mcp-config, ignoring all other MCP configurations
  --system-prompt <prompt>                          System prompt to use for the session
  --tmux                                            Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.
  --tools <tools...>                                Specify the list of available tools from the built-in set. Use "" to disable all tools, "default" to use all tools, or specify tool names (e.g. "Bash,Edit,Read").
  --verbose                                         Override verbose mode setting from config
  -v, --version                                     Output the version number
  -w, --worktree [name]                             Create a new git worktree for this session (optionally specify a name)

Commands:
  agents [options]                                  List configured agents
  auth                                              Manage authentication
  doctor                                            Check the health of your Claude Code auto-updater
  install [options] [target]                        Install Claude Code native build. Use [target] to specify version (stable, latest, or specific version)
  mcp                                               Configure and manage MCP servers
  plugin                                            Manage Claude Code plugins
  setup-token                                       Set up a long-lived authentication token (requires Claude subscription)
  update|upgrade                                    Check for updates and install if available

参数:
prompt - 您的提示词
选项:
--add-dir <directories...> - 允许工具访问的附加目录
--agent <agent> - 当前会话的代理。覆盖 'agent' 设置
--agents <json> - JSON 对象定义自定义代理(例如:'{"reviewer": {"description": "审查代码", "prompt": "你是一位代码审查员"}}')
--allow-dangerously-skip-permissions - 启用绕过所有权限检查的选项,默认不启用。仅推荐在无法访问互联网的沙盒环境中使用
--allowedTools, --allowed-tools <tools...> - 允许使用的工具名称列表,逗号或空格分隔(例如:"Bash(git:*) Edit")
--append-system-prompt <prompt> - 在默认系统提示后追加系统提示
--betas <betas...> - API 请求中包含的 Beta 功能头(仅限 API 密钥用户)
--chrome - 启用 Claude in Chrome 集成
-c, --continue - 继续当前目录中最近的对话
--dangerously-skip-permissions - 跳过所有权限检查。仅推荐在沙盒环境中使用
--debug [filter] - 启用调试模式,可选择性过滤类别(例如:"api,hooks" 或 "!1p,!file")
--debug-file <path> - 将调试日志写入指定文件路径(隐式启用调试模式)
--disable-slash-commands - 禁用所有技能命令
--disallowedTools, --disallowed-tools <tools...> - 禁止使用的工具名称列表,逗号或空格分隔(例如:"Bash(git:*) Edit")
--effort <level> - 当前会话的努力程度(low、medium、high)
--fallback-model <model> - 当默认模型过载时自动回退到指定模型(仅与 --print 一起使用)
--file <specs...> - 启动时下载的文件资源。格式:file_id:relative_path(例如:--file file_abc:doc.txt file_def:img.png)
--fork-session - 恢复时创建新会话 ID 而不是重用原始会话(与 --resume 或 --continue 一起使用)
--from-pr [value] - 通过 PR 编号/URL 恢复链接到 PR 的会话,或使用可选搜索词打开交互式选择器
-h, --help - 显示命令帮助信息
--ide - 启动时如果恰好有一个有效的 IDE 可用则自动连接
--include-partial-messages - 包含到达时的部分消息块(仅与 --print 和 --output-format=stream-json 一起使用)
--input-format <format> - 输入格式(仅与 --print 一起使用):"text"(默认)、"stream-json"(实时流式输入)
--json-schema <schema> - 用于结构化输出验证的 JSON Schema。示例:{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}
--max-budget-usd <amount> - API 调用的最大美元金额(仅与 --print 一起使用)
--mcp-config <configs...> - 从 JSON 文件或字符串加载 MCP 服务器(空格分隔)
--mcp-debug - [已弃用,请使用 --debug] 启用 MCP 调试模式(显示 MCP 服务器错误)
--model <model> - 当前会话的模型。提供最新模型的别名(例如 'sonnet' 或 'opus')或模型的完整名称(例如 'claude-sonnet-4-6')
--no-chrome - 禁用 Claude in Chrome 集成
--no-session-persistence - 禁用会话持久化 - 会话不会保存到磁盘且无法恢复(仅与 --print 一起使用)
--output-format <format> - 输出格式(仅与 --print 一起使用):"text"(默认)、"json"(单个结果)或 "stream-json"(实时流式)
--permission-mode <mode> - 会话使用的权限模式(acceptEdits、bypassPermissions、default、dontAsk、plan)
--plugin-dir <paths...> - 仅为此会话从指定目录加载插件(可重复)
-p, --print - 打印响应并退出(适用于管道)。注意:使用 -p 模式时会跳过工作区信任对话框。仅在您信任的目录中使用此标志
--replay-user-messages - 从 stdin 重新发出用户消息到 stdout 进行确认(仅与 --input-format=stream-json 和 --output-format=stream-json 一起使用)
-r, --resume [value] - 按会话 ID 恢复对话,或使用可选搜索词打开交互式选择器
--session-id <uuid> - 为对话使用特定的会话 ID(必须是有效的 UUID)
--setting-sources <sources> - 要加载的设置源逗号分隔列表(user、project、local)
--settings <file-or-json> - 加载设置 JSON 文件的路径或 JSON 字符串以加载额外设置
--strict-mcp-config - 仅使用 --mcp-config 中的 MCP 服务器,忽略所有其他 MCP 配置
--system-prompt <prompt> - 会话使用的系统提示
--tmux - 为工作树创建 tmux 会话(需要 --worktree)。可用时使用 iTerm2 原生面板;使用 --tmux=classic 使用传统 tmux
--tools <tools...> - 指定内置工具集中的可用工具列表。使用 "" 禁用所有工具,"default" 使用所有工具,或指定工具名称(例如 "Bash,Edit,Read")
--verbose - 覆盖配置中的详细模式设置
-v, --version - 输出版本号
-w, --worktree [name] - 为此会话创建新的 git worktree(可选指定名称)
命令:
agents [options] - 列出配置的代理
auth - 管理身份验证
doctor - 检查 Claude Code 自动更新器的健康状况
install [options] [target] - 安装 Claude Code 原生版本。使用 [target] 指定版本(stable、latest 或特定版本)
mcp - 配置和管理 MCP 服务器
plugin - 管理 Claude Code 插件
setup-token - 设置长期有效的认证令牌(需要 Claude 订阅)
update|upgrade - 检查更新并在可用时安装

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐