# How to copy last output from CLI without spaces

**URL:** <https://forum.cursor.com/t/how-to-copy-last-output-from-cli-without-spaces/176243>\
**Category:** Help\
**Tags:** cli\
**Created:** [October 26, 2026, 1:32pm UTC](https://forum.cursor.com/t/how-to-copy-last-output-from-cli-without-spaces/176243 "2026-10-26T13:32:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![torusJKL](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/torusjkl/32/124582_2.png) [@torusJKL](https://forum.cursor.com/u/torusJKL)\
**Post date:** [October 26, 2026, 1:32pm UTC](https://forum.cursor.com/t/how-to-copy-last-output-from-cli-without-spaces/176243/1 "2026-10-26T13:32:07Z")

</div>

Cursor CLI (v2026.10.22-27dcf5f) in PowerShell 7.

I often want to copy the last output.  
I couldn’t find a command to do that so I mark the relevant text and copy it (ctrl+c).

The issue with this approach is that every line receives two spaces at the beginning which comes from how the CLI renders the text but they shouldn’t be part of the text I copy.

Is there a way to copy output without these two spaces?

Thanks!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/colin/32/90452_2.png) [@Colin](https://forum.cursor.com/u/Colin)\
**Post date:** [October 26, 2026, 5:25pm UTC](https://forum.cursor.com/t/how-to-copy-last-output-from-cli-without-spaces/176243/5 "2026-10-26T17:25:30Z")

</div>

Hey @torusJKL,

Yes, type `/copy` in the CLI. It opens a picker of earlier messages with the newest at the top, so pressing Enter on the first row copies the last reply as plain text, without the two-space indent. If that reply had several steps, a second list opens; pick “Last assistant message”. On Windows it copies through PowerShell, so there’s nothing extra to set up.

For one-off questions, `agent -p "your prompt" | Set-Clipboard` also gives you the answer without the indent.

Selecting text directly in the terminal will still pick up those spaces, since the CLI draws the margin with real space characters.

---

<div class="post-metadata">

**Author:** ![torusJKL](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/torusjkl/32/124582_2.png) [@torusJKL](https://forum.cursor.com/u/torusJKL)\
**Post date:** [October 28, 2026, 8:05am UTC](https://forum.cursor.com/t/how-to-copy-last-output-from-cli-without-spaces/176243/7 "2026-10-28T08:05:37Z")

</div>

So obvious. 🤦

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [October 30, 2026, 8:06am UTC](https://forum.cursor.com/t/how-to-copy-last-output-from-cli-without-spaces/176243/8 "2026-10-30T08:06:04Z")

</div>

Closed on October 30, 2026, 8:06am UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
