PTENES
Skip to content
MODULE 1.2

⌨️ Navigating the CLI Like a Pro

Keyboard shortcuts, slash commands, model and context, sessions, images, and Unix pipes. Everything that separates a basic user from a Claude Code power user.

6
Topics
~40
Minutes
1.1
Prerequisite
Practical
Type
Progress: 0% 0 of 6
1

⚡ Essential Keyboard Shortcuts

🧠 Imagine It This Way: keyboard shortcuts in Claude Code are like shortcuts in Vim. At first you ignore them; once you learn them, you can't live without them. The difference is that here, just 5-6 keys cover everything.

During an interactive Claude Code session, some keys have special behavior that dramatically speeds up your workflow. The trick is that they are few: five shortcuts cover 95% of interactions. Knowing these five keys transforms the experience from “type and wait” to “control the flow precisely.” It's the difference between driving automatic and manual: in automatic, you're at the mercy of AI; in manual, you decide when to brake, when to accelerate, and when to back up.

The most important of all is the Escape: it cancels the current operation and returns you to a clean prompt. When Claude is editing a file and you realize it's heading in the wrong direction, press Escape to stop everything. Next comes the Tab to accept autocomplete suggestions, Ctrl+C to stop a long-running generation that has already done all it can, Shift+Tab to reject a suggestion, and Double Enter to send multi-line messages. With these five, you can navigate any session.

✓ Essential Shortcuts

  • • Escape — cancels the current action / returns to the prompt
  • • Tab — accepts suggestions / autocomplete
  • • Ctrl+C — stops generation in progress
  • • Shift+Tab — reject suggestion
  • • Enter double — sends a multi-line message

→ Navigation tips

  • • Up arrow — edit the last message
  • • Ctrl+L — clear the screen (without losing context)
  • • / at the beginning — opens slash commands
  • • @ — reference a file by name
  • • Paste an image — automatic visual analysis
Escape Tab Ctrl+C Shift+Tab Enter x2 Full session control 5 Keys = Power User

💡 Tip: Practice the Shortcuts

In your next Claude Code session, make yourself use only shortcuts for 10 minutes. Ask for something, cancel with Escape, ask again, accept with Tab, interrupt with Ctrl+C. In less than an hour, you'll be on autopilot and never go back to the slow way.

In one sentence: Escape, Tab, Ctrl+C, Shift+Tab, and double Enter cover 95% of interactions.

2

🔧 Slash Commands — The Control Panel

🧠 Imagine It This Way: slash commands are Claude Code’s hidden control panel. Type /, a menu appeared. It’s like the VS Code command palette, but inside your conversation with AI.

In an interactive session, type / at the beginning of the message activates the slash commands. They control the session without using conversation tokens. While a regular message goes to the model (and uses context), a slash command runs locally: it costs nothing and takes effect immediately.

The most commonly used ones form a basic kit every user should memorize. /help lists everything that's available. /clear clears the conversation context (useful when the context has gotten cluttered). /compact compresses the conversation into a shorter summary to free up space. /model shows or switches the model. /memory saves preferences that persist across sessions. /cost shows how much you've spent in the session. And /resume resumes a previous session.

essential slash commands
/help       — lista todos os comandos disponíveis
/clear      — limpa o contexto da conversa atual
/compact    — comprime o contexto para liberar espaço
/model      — ver ou trocar o modelo em uso
/memory     — salvar uma nota persistente
/resume     — retomar sessão anterior
/cost       — ver quanto gastou na sessão atual
/config     — abrir configurações

/help

The starting point. Shows everything available. Run it when you're lost.

/clear

Clears all context. Useful when you want to start over without closing the terminal.

/compact

Compresses the conversation into a summary to free up context. Use it before the context fills up.

/model

Shows which model is active. You can switch between Opus and Sonnet without leaving the session.

/memory

Saves a preference that persists across sessions. Example: "always use TypeScript".

In one sentence: type / to access the Claude Code control panel within the session.

3

🧠 Model and Context Window

🧠 Imagine It This Way: the model is the brain; the context window is working memory. Imagine Claude has a desk with limited space. Everything you say and everything it reads goes on the desk. When it fills up, something falls off.

Claude Code uses models from Anthropic's Claude family. The default is usually the Claude Sonnet (fast and capable for most tasks), but you can switch to Claude Opus (deeper, better at complex reasoning and large codebases) at any time with /model or --model. Understanding the difference between them and knowing when to switch is a skill that separates efficient users from users who waste money or time.

A context window is the limit of what the model can see at once: everything you said, everything it read, all the files inspected, and all the responses generated. Claude’s context window is approximately 200k tokens (about 150k words). It seems like a lot, but an average codebase uses it up quickly. Every file read, every response generated, every CLAUDE.md loaded consumes tokens from this window. When the space runs out, Claude starts forgetting the beginning of the conversation.

✓ Claude Sonnet

  • • Fast and responsive
  • • Good for common tasks
  • • Cheaper per token
  • • Ideal for quick edits and questions

→ Claude Opus

  • • Deeper and more accurate
  • • Better at complex reasoning
  • • More expensive per token
  • • Ideal for refactoring and architecture
CONTEXT WINDOW (~200k tokens) System prompt CLAUDE.md Your messages prompts + history Files read code + configs Answers model output Limit! forget it here

⚠️ Signs of a Full Context Window

Claude starts forgetting instructions from the beginning, repeats questions you've already answered, ignores CLAUDE.md rules, or simply stops working well. When you notice this, use /compact or start a new session.

In one sentence: Sonnet = fast, Opus = deep; 200k tokens is the workbench, and everything competes for space.

4

💾 Sessions and /resume

🧠 Imagine It This Way: Closing the terminal doesn't erase the conversation. It's like closing a book with a bookmark. When you come back, /resume opens to the right page.

Claude Code automatically persists sessions to the local disk. Each conversation has a session ID and it’s saved in ~/.claude/. This means closing the terminal, shutting down the computer, or even switching tabs won’t lose anything. The session stays there, waiting for you to come back.

To resume, you have two options: claude --resume on the command line (before opening a new session) or /resume from within an open session. Both show a picker with recent sessions for you to choose from. You can also resume a specific session by ID: claude --resume SESSION_ID.

In practice, the ideal pace is to work in one session for 1-2 hours, commit checkpoints in git, and start a new session when the context fills up. If you need to pick something up from the previous day, --resume recovers. But remember: very long sessions degrade the quality of responses because the context gets full. Sometimes it’s better to start fresh and let the CLAUDE.md load the essential context.

resuming sessions
# retomar a última sessão
claude --resume

# dentro de uma sessão, retomar outra
/resume

# continuar conversa específica por ID
claude --resume SESSION_ID

# listar sessões recentes
claude --resume  (mostra picker interativo)

💡 New Session vs. Resume

If you're picking up the same work from yesterday, use --resume. If you’re starting a different task (even in the same project), start a new session. Mixing contexts from different tasks clutters the window and degrades quality.

In one sentence: sessions persist on disk; --resume or /resume resumes where you left off.

5

🖼️ Reading Images and Screenshots

🧠 Imagine It This Way: you can paste a screenshot of a bug into the terminal, and Claude Code will analyze it visually, identify the problem, and suggest a fix. It’s like having an extra pair of eyes that can read code on the screen.

Claude Code is multimodal. It can read images in three ways: paste from clipboard (Ctrl+V with a copied screenshot), reference a file from an image in the filesystem (using @path/to/image.png), or drag and drop in the terminal (on supported terminals). This opens up a huge range of use cases that don't exist in traditional web chatbots.

The most common use cases are: visual debugging of the UI (paste a screenshot of the bug, and Claude identifies the problem in the CSS/HTML), reproduce a design from a mockup (paste the Figma export, ask it to implement it), and read diagrams of architecture (a photo of a whiteboard becomes a structured description). You can also provide UML diagrams, metric charts, or formatted log screenshots.

Be careful about the cost: images consume tokens (a lot of them). A full-screen screenshot can use 1000-2000 tokens. If the problem can be described in text, prefer text. Save images for when visual information is genuinely necessary: layouts, colors, positioning, charts, error screenshots.

Ctrl+V (clipboard)

Take a screenshot and paste it directly into the session. The fastest way to handle visual bugs.

@arquivo.png

References an image file on disk. Ideal for mockups and assets already saved.

Drag & Drop

Drag from the file manager into the terminal. Works in modern terminals (iTerm2, etc.).

⚠️ Vision Limitations

Claude Code can't edit images, only analyze them. It also can't accurately read very small text in high-resolution screenshots. For best results, focus the screenshot on the relevant area and zoom in if needed.

In one sentence: paste screenshots, provide image paths, or drag files in, and Claude analyzes them visually.

6

📤 Formatted Output and Unix Pipes

🧠 Imagine It This Way: the mode -p turns Claude Code into a first-class Unix citizen. Everything it responds with goes to stdout, ready to pipe through jq, grep, or redirect to a file. It fits the Unix philosophy: do one thing well and connect with everything.

Integration with the Unix ecosystem is one of Claude Code's most underrated superpowers. With claude -p, the output goes directly to stdout, letting you chain it with any Unix tool. You can receive input via stdin (input pipe), process it with Claude, and send the output to another tool or file. This makes Claude Code composable: it becomes another block in your toolchain.

The flag --output-format json makes Claude return the response as structured JSON, which is perfect for automated processing. Combine it with jq to extract specific fields, or with scripts that consume JSON. For more complex scripts, you can use --output-format stream-json to receive tokens in real time as the model generates them.

pipe examples
# gerar JSON e processar com jq
claude -p "liste 5 tarefas em JSON" | jq '.[]'

# analisar um arquivo e salvar resultado
claude -p "revise este código" < app.py > review.md

# pipe de entrada: mandar conteúdo para análise
git diff | claude -p "resuma estas mudanças em 3 bullets"

# output em JSON estruturado
claude -p "..." --output-format json

# encadear múltiplas ferramentas
find . -name "*.ts" | head -20 | claude -p "quais desses arquivos são testes?"
stdin / pipe git diff | ... claude -p "..." processes and responds | jq | grep > arquivo.md

🔬 Worked Example: Automated PR Review

A real-world use of pipes: automate code review with a single line.

git diff main...HEAD | claude -p "Revise este diff. Aponte bugs, melhorias e se segue padroes. Formato: markdown." > review.md

This takes the diff between your branch and main, sends it to Claude for analysis, and saves the result in a Markdown file. It takes 10 seconds to run and replaces 30 minutes of manual review on simple PRs.

In one sentence: claude -p + Unix pipes = AI as a composable command-line tool.

🧾 Module Summary

✓
5 Essential Shortcuts — Escape, Tab, Ctrl+C, Shift+Tab, and double-press Enter.
✓
Slash commands — /help, /clear, /compact, /model, /memory, /resume control the session.
✓
Model and context — Sonnet (fast) or Opus (deep); 200k-token context window.
✓
Unix pipes — claude -p turns AI into a composable terminal tool.

Next module:

1.3 — CLAUDE.md: the file that turns Claude Code from a generalist into a specialist in your project.