Claude Code CLI 命令速查表

150 阅读4分钟

我整理了 Mac 上 Claude Code CLI 工具中,官方所有的模型和命令以及相关的快捷键,供大家参考和查阅

为了防止你以后找不到,建议先点赞收藏起来,下面我们正式开始

符号命令( Symbol Command)

共计 4 个,对大多人而言,@/ 最常用

符号命令说明Description
!bash 模式for bash mode
/命令模式for commands
@引用文件路径for file paths
&后台运行for background

快捷键( Shortcut)

共计 8 个

快捷键说明Description
esc + esc清除所有输入内容double tap esc to clear input
shift + tab自动接收编辑to auto-accept edits
ctrl + o查看详细输出for verbose output
shift + ⏎换行newlines
ctrl + _撤销to undo
ctrl + z暂停to suspend
cmd + v粘贴图片to paste images
ctrl + s暂存提示词to stash prompt

斜杠命令(Slash Command)

共计 30 个

斜杠命令说明Description
/help显示帮助和可用命令Show help and available commands
/skills列举可用技能List available skills
/todos列举当前所有的待办项List current todo items
/agents管理 智能体 配置Manage agent configurations
/add-dir添加一个新的工作目录Add a new working directory
/chromeClaude Chrome 浏览器插件(测试版)设置Claude in Chrome (Beta) settings
/clear清除历史会话,然后释放上下文Clear conversation history and free up context
/compact清除对话历史记录,但保留上下文摘要。 可选操作:/ 精简模式Clear conversation history but keep a summary in context. Optional: /compact [instructions for summarization]
/config打开配置面板Open config panel
/rename重命名当前会话Rename the current conversation
/usage显示计划使用限额Show plan usage limits
/context将当前上下文占用情况可视化为彩色网格Visualize current context usage as a colored grid
/terminal-setup启用 Option+Enter 快捷键的换行及视觉提示音功能Enable Option+Enter key binding for newlines and visual bell
/cost显示当前会话的总开销Show the total cost and duration of the current session
/doctor诊断并验证你的 Claude Code 安装及设置情况Diagnose and verify your Claude Code installation and settings
/exit退出 REPLExit the REPL
/export导出当前会话到一个文件中或者剪切板Export the current conversation to a file or clipboard
/fork在此节点复刻当前对话的分支版本Create a fork of the current conversation at this point
/hooks管理工具事件的钩子配置Manage hook configurations for tool events
/ide管理 IDE 集成并显示状态Manage IDE integrations and show status
/init新建一个 CLAUDE.md 文件并写入代码库文档内容Initialize a new CLAUDE.md file with codebase documentation
/install-github-app为代码仓库配置 Claude GitHub 工作流Set up Claude GitHub Actions for a repository
/install-slack-app安装 Claude Slack 应用Install the Claude Slack app
/login使用你的 Anthropic 账号登录Sign in with your Anthropic account
/logout退出你的 Anthropic 账号Sign out from your Anthropic account
/mcp管理 MCP 服务Manage MCP servers
/memory编辑 Claude 记忆文件Edit Claude memory files
/mobile展示二维码以下载 Claude 移动应用Show QR code to download the Claude mobile app
/model为 Claude Code 设置 AI 模型Set the AI model for Claude Code
/output-style直接或通过选择菜单设置输出格式Set the output style directly or from a selection menu
/permissions管理工具权限的允许与拒绝规则Manage allow & deny tool permission rules
/plan启用规划模式或查看当前会话规划Enable plan mode or view the current session plan
/plugin管理 Claude Code 插件Manage Claude Code plugins
/pr-comments获取 GitHub 拉取请求中的评论Get comments from a GitHub pull request
/release-notes查看更新日志View release notes
/resume恢复对话Resume a conversation
/rewind将代码和 / 或对话恢复至之前的节点Restore the code and/or conversation to a previous point
/reviewReview 拉取请求Review a pull request
/sandbox○ 沙箱功能已禁用(按回车键进行配置)○ sandbox disabled (⏎ to configure)
/security-review对当前分支的待处理变更完成安全审核Complete a security review of the pending changes on the current branch
/stats查看你的 Claude Code 使用数据及活动记录Show your Claude Code usage statistics and activity
/status查看 Claude Code 状态信息,包括版本、模型、账号、API 连接状态及工具运行状态Show Claude Code status including version, model, account, API connectivity, and tool statuses
/statusline配置 Claude Code 的状态栏界面Set up Claude Code's status line UI
/stickers申领 Claude Code 贴纸Order Claude Code stickers
/tasks列出并管理后台任务List and manage background tasks

运行示例

/cost

这里可以看到你的 API 花销

/doctor

这个可以看到你的环境相关的配置

/context

这里可以清除的看到上下文使用的情况

/stats

模型使用量统计,支持查看所有时间,过去 7 天,过去 30 天的数据

/task

/memory

/chrome

/config --> Language (语言设置)

/config --> Status (配置状态查询)

这里从 url host可以看出使用的模型类型,我使用的是 bigmodel(智谱)的

/help --> custom-commands

安装的自定义命令,部分 Skills 会出现在这里

/config --> Model ( 模型切换)

官方支持 3 种模型

模型描述
Sonnet 4.5默认模型,用于处理日常事务
Opus 4.5最强模型,用于处理复杂事务
Haiku 4.5最快模型,用于日常快速问答

/config --> Config --> Default permission mode ( 默认权限模式)

/config --> Config --> Editor (编辑器模式)

/config --> Config --> Notifinations (通知样式配置)

/config --> Config --> Theme ( 主题配置)