Claude Code for beginners: copy just the code block

You want to keep a code snippet from Claude Code. Dragging across a terminal reply can pick up half the explanation or miss the last line of code. With /copy, you can select the block itself.

Copy a block from a reply

Start in an open Claude Code terminal session. If this is your first session, follow Anthropic’s setup guide.

  1. Find the reply with the snippet you want to keep. Check that the code sits in its own block.
  2. Enter /copy for Claude’s latest reply. For the second-to-last reply, enter /copy 2. The number selects the reply, not the block within it.
  3. Choose the code block in the picker and paste it into a blank note. Check that the first and last lines made it across.

The picker appears when the reply contains code blocks or blockquotes. If the reply is plain text, the command copies the whole reply. If you need the explanation alongside the code, you can also choose the full reply in the picker.

Source: Anthropic’s Claude Code commands reference.

The Forge newsletter

Get new articles in your inbox

Pick the topics you care about. No noise, at most one email a week.

Get new articles in your inbox

We follow GDPR. Unsubscribe anytime.