Claude Code CLI Basics
The parts of the interface worth knowing before you're 20 minutes into a task.
Beginner
/ control the session itself, rather than being
a request for Claude to do something in your code.
| Command | Does |
|---|---|
| /help | lists available commands and basic usage |
| /clear | starts a fresh session, discarding the current conversation's context |
| /compact | summarizes the conversation so far to free up context — use before you hit the limit, not after |
| /config | opens configuration settings |
| /init | generates a starter CLAUDE.md by having Claude read and summarize the codebase |
! runs it as a literal shell command in the current
session rather than a message to Claude — handy for something you want to run yourself
and have the output land directly in the conversation (e.g. an interactive login command
Claude shouldn't run on your behalf).
Tool(pattern) and live in an allow/deny list —
deny always wins over allow, and a more specific pattern overrides a
general one.
{
"permissions": {
"allow": [
"Bash(npm run test *)",
"Read(~/.zshrc)"
],
"deny": [
"Bash(curl *)",
"Read(./.env)",
"Read(./secrets/**)"
]
}
}
| Location | Scope | Shared? |
|---|---|---|
~/.claude/settings.json | you, every project | no |
.claude/settings.json | this project | yes — commit it |
.claude/settings.local.json | you, this project only | no — gitignore it |
| Managed policy settings | every user in the organization | yes, IT-deployed |
allow/deny rules specifically, which merge across every scope
instead of the higher one overriding the lower. Run /status in a session to
see exactly which settings files actually loaded.
| Key | Does |
|---|---|
| model | sets the session's model — see Choosing a Claude Model |
| autoMemoryEnabled | toggles auto memory (on by default) — see Effective Prompting |
| hooks | event-triggered scripts — see Hooks & Automation |
| env | environment variables set for every tool call in the session |
/compact helps with context but doesn't reset your account-level usage.