Claude Code Terminal: Setup, Models, Multi-Session
9 min read
Key takeaways
- Bracketed paste support, strong ANSI rendering, and large scrollback are the terminal qualities that keep long Claude Code sessions readable.
- Type /model to switch models mid-session; the change applies to your next prompt, and .claude/settings.json sets a per-project default.
- Most terminal failures come from a missing PATH entry, stale OAuth tokens, escape-sequence glitches, or network stalls, and each has a quick fix.
- Run one terminal tab per agent in its own git worktree so parallel sessions never collide on branches.
- Use claude --continue or claude --resume to restore conversation history instead of re-explaining context.
Running Claude Code in the terminal works well once you pick a terminal with solid rendering, install the CLI, and learn the two commands that switch models mid-session. This guide covers those steps plus fixes for the failures that break sessions, and setups for running several agents side by side in git worktrees.
What makes a terminal good (or bad) for Claude Code?
Claude Code is a CLI tool, so the terminal is the whole interface: rendering, input handling, and scrollback determine whether long agent sessions stay readable. Anthropic's installation and getting-started docs list the baseline requirements: a POSIX-style shell, Node.js, and a terminal with standard escape-sequence support. Anything beyond that baseline affects how usable it is when you run several sessions side by side.
Rendering, paste, and scrollback: the three things that break sessions
Rendering. Claude Code uses ANSI color, progress spinners, and diff highlighting. A terminal that mangles those (or renders them slowly) makes diffs hard to review.
Paste. You will paste long prompts, error logs, and file paths. Bracketed paste mode matters: without it, multi-line pastes execute line by line instead of arriving as one block.
Scrollback. Agent sessions run long and print a lot. Unlimited or very large scrollback lets you review an earlier diff without re-running anything. Six terminals open at once also means memory per tab counts.
Comparing common terminals for Claude Code
| Terminal | Rendering | Bracketed paste | Scrollback | Notes for parallel sessions |
|---|---|---|---|---|
| iTerm2 | Strong | Yes | Configurable, unlimited | Split panes keep sessions visible |
| Ghostty | Strong | Yes | Large by default | GPU-rendered, fast with heavy output |
| Alacritty | Strong | Yes | Configurable via tmux | No built-in tabs; pair with tmux |
| Windows Terminal | Good | Yes | Configurable | WSL required for Claude Code |
| macOS Terminal.app | Basic | Yes | Limited default | Fine for one session, cramped for six |
If you run one session, any of these works. If you queue the next prompt across several terminals while agents stay busy, split panes or tabs plus generous scrollback are what you actually feel. Rendering cost matters too: polling many sessions burns tokens (see our breakdown of coding agent costs), so a terminal that keeps output legible at a glance saves more than milliseconds.
How do you install and run Claude Code in the terminal?
Install Claude Code with npm install -g @anthropic-ai/claude-code, then run claude from any directory to verify the binary works. If you prefer not to touch your global npm packages, the native installer (curl -fsSL https://claude.ai/install.sh | bash) puts the binary on your PATH without Node as a dependency.
First launch and authentication
The first claude run in a project walks you through authentication: pick your Anthropic console account (API-key billing) or log in with a Claude Pro or Max subscription. Once authenticated, the session opens an interactive REPL where you type prompts and approve file edits or shell commands as the agent proposes them. Approval prompts are the main thing to watch when running several sessions side by side, since each terminal will ask independently.
Starting a session in the right directory
Claude Code treats your current working directory as the project root, so cd into the repo before launching. For multi-repo work, launch from a parent directory or a git worktree checkout so the agent can see the files it needs; the same discipline matters when parallel agents touch shared repos (https://aerunit.ai/cross-repo-changes-with-coding-agents). Use claude --continue to resume your last session or claude --resume to pick an earlier one, which saves re-explaining context when you queue the next prompt.
How do you change the model in Claude Code mid-session?
Type /model in the session and pick from the list. The switch takes effect on your next prompt, so finish the current task first; a mid-task switch can change the plan quality halfway through a refactor. Anthropic's Claude Code docs cover the /model command and model configuration.
Switching with /model
Use /model when the job changes shape: a fast model for mechanical edits across worktrees, a stronger one for architecture or gnarly merges. If you are running several agents in parallel and reviewing diffs between prompts, downgrading the routine sessions cuts cost without touching the ones doing hard reasoning.
Setting a default model per project
Put "model" in the project's .claude/settings.json so every session in that repo starts on the model you want, and teammates get the same default. Per-project defaults beat muscle memory when you are queueing the next prompt across six terminals.
One honest limit: switching models does not fix context degradation. If the first step misunderstood your file structure, a better model inherits the same broken state. We compare how agents handle handoffs in our cloud coding agents comparison.
Why is Claude Code not working in your terminal, and how do you fix it?
Most Claude Code failures in the terminal fall into four buckets: the binary isn't found, auth is broken, the display glitches, or a session hangs. Work down this list before reinstalling anything.
Command not found or wrong Node version
command not found: claude usually means the npm global bin directory isn't on your PATH, or you installed with a Node version manager whose PATH only loads in some shells. Run which claude and node --version in the same shell you're launching from. If Node is old, upgrade it; Claude Code requires a current Node LTS. A shell alias pointing at a dead install path causes the same symptom.
Authentication and network failures
Auth errors after an upgrade often mean a stale OAuth token. Run claude /logout then /login, or clear the config directory and re-authenticate. Corporate proxies and VPNs break the API connection silently; check whether a plain API call from the same machine works. If you're behind a proxy, set HTTPS_PROXY explicitly rather than assuming the terminal inherits it.
Rendering and input glitches
Flickering, duplicated lines, or a cursor that jumps usually means the terminal doesn't handle the escape sequences Claude Code emits. Switch to a terminal with proper Unicode and truecolor support, resize the window, or run claude --resume to redraw. Pasted text mangling is often bracketed-paste handling; try a different terminal before blaming the CLI.
Session hangs and stuck requests
A stuck request is usually a network stall, not a crash. Press Escape to interrupt, then retry; if the session is wedged, claude --resume picks up the conversation history. The deeper failure mode is coordination, not connectivity: when you're running several sessions side by side, a hang in one blocks the next prompt you were going to paste. That queueing problem, where you are the glue between steps and lose track of what ran when, is what Aerunit addresses by keeping agents fed with well-scoped work from Linear while you review diffs instead of polling terminals. The same discipline applies in a plain terminal: write acceptance criteria into the prompt before launching, so a resumed session knows what "done" means without you re-explaining it.
How does Claude Code's terminal integration differ from IDE-based agents?
The terminal version runs anywhere git runs: over SSH, on a headless box, in a tmux pane next to five other sessions. IDE plugins inherit the editor's UI, file tree, and extension host, so they are convenient but tied to one window and one workspace. In the terminal you can pipe output, script sessions, and run Claude Code against a repo you never opened in an editor.
What you give up: inline diff views, click-to-jump diagnostics, and the IDE's language-server awareness. Claude Code compensates by reading the repo directly, but when a session hangs or output renders wrong, you troubleshoot it yourself, which is where Anthropic's Claude Code troubleshooting documentation earns its keep.
The coordination gap is the real cost. With six terminals running, you become the dispatcher: queueing the next prompt, checking whether work is actually done, reviewing diffs one by one. Tools like Aerunit (instant feedback for coding agents) exist because that glue work does not shrink on its own.
Which terminal settings affect Claude Code performance and rendering?
Scrollback is the first thing to tune. Long agent runs print thousands of lines, and a default 1,000-line buffer means you lose the diff context you need when reviewing. Set your scrollback to 10,000 lines or unlimited before a session.
Next, check your environment against Anthropic's documented requirements: a supported OS, a current Node version, and WSL specifics if you are on Windows (Anthropic's Claude Code docs). Running Node below the supported version causes install and startup failures that look like terminal problems.
Font and emoji handling matter more than they sound. Claude Code uses box-drawing characters and emoji in its status output; a font without those glyphs renders broken boxes that make progress output hard to scan. Pick a Nerd Font or similar.
Finally, enable your shell's OSC escape-sequence support if available, since shell integration lets Claude Code report working directory and command state reliably across chained sessions.
When should you use Claude Code in the terminal instead of an IDE plugin?
Use the terminal when sessions run long, you run more than one at a time, or the work is planned in Linear rather than in an open editor tab. The IDE plugin wins when you are iterating on a single file set with the diff in front of you. Past roughly two parallel sessions, the terminal stops being a preference and becomes the only practical surface.
Running several sessions: worktrees and one terminal per agent
Give each agent its own git worktree so branches never collide, and one terminal tab or pane per worktree. Queue the next prompt the moment an agent finishes instead of watching it run; polling burns tokens and your attention. The bottleneck is not the model, it is you switching between six terminals to paste prompts and review the diff.
That coordination gap is why Aerunit exists: it pulls scoped Linear work, keeps Cursor Cloud Agents busy across repos, and hands you the diffs for review. The terminal handles the sessions; the queue handles the routine around them.
FAQ
Does Claude Code work on Windows terminals, or do I need WSL?
You need WSL. Claude Code targets a POSIX-style shell, so Windows Terminal only works as a host for a WSL session rather than running the CLI natively. Once WSL is set up, Windows Terminal handles rendering, bracketed paste, and scrollback well enough for parallel sessions.
How much does it cost to run Claude Code in the terminal all day?
It depends on model choice and how often you poll. Long sessions with a stronger model burn far more tokens than routine edits on a fast one, and watching six terminals run adds polling overhead. Downgrade mechanical sessions with /model and write acceptance criteria up front to cut wasted prompts.
Can I queue the next prompt while Claude Code is still working?
Not in a single session; each terminal waits for its agent to finish before accepting input. The practical pattern is one terminal or pane per agent in its own git worktree, so you paste the next prompt into whichever session just freed up instead of waiting on all of them.
Why does Claude Code forget context between sessions in the same terminal?
Each launch starts fresh unless you resume. Use claude --continue for your last session or claude --resume to pick an earlier one, which restores the conversation history. Switching models mid-session does not fix a degraded context, so if the first step misunderstood your repo, restart with a clearer prompt.