Paste the Last Deleted Text in Terminal (Ctrl+Y)
Press Ctrl+Y to paste (yank) back the last text you deleted with Ctrl+U, Ctrl+K or Ctrl+W. The terminal keeps deletions in a kill-ring. Same key on macOS Terminal, Linux and Windows WSL / Git Bash.
| Action | Mac | Windows | |
|---|---|---|---|
| Paste last deletion (yank) | Ctrl+Y | Ctrl+Y | |
| Cycle through earlier deletions | Alt+Y | Alt+Y | |
| Delete to start of line | Ctrl+U | Ctrl+U | |
| Delete previous word | Ctrl+W | Ctrl+W |
Undo a terminal deletion
When you remove text with Ctrl+U, Ctrl+K or Ctrl+W, it is not lost — readline stores it in a kill-ring. Press Ctrl+Y to yank the most recent deletion back onto the line at the cursor. Same behaviour in bash and zsh on macOS Terminal, Linux and Windows WSL / Git Bash.
Reach older deletions with Alt+Y
Right after Ctrl+Y, press Alt+Y to replace what you just yanked with the previous item in the kill-ring. Keep pressing to cycle back through earlier deletions.
Yank is not the system clipboard
The kill-ring is separate from the macOS/Windows clipboard. Ctrl+Y pastes what you deleted inside the terminal, not what you copied with Cmd+C / Ctrl+C in another app.
FAQ
How do I get back text I deleted in the terminal?
Press Ctrl+Y to yank back the last text removed with Ctrl+U, Ctrl+K or Ctrl+W. It works in bash and zsh on Mac, Linux and WSL.
What is the kill-ring?
Readline stores your recent deletions in a list called the kill-ring. Ctrl+Y pastes the newest; Alt+Y cycles to older entries.
Does Ctrl+Y paste from my system clipboard?
No. Ctrl+Y pastes from the terminal's internal kill-ring, not the macOS or Windows clipboard.
How do I paste an older deletion, not the last one?
Press Ctrl+Y first, then Alt+Y repeatedly to rotate back through earlier items in the kill-ring.