Delete to End of Line in Terminal (Ctrl+K)
Press Ctrl+K to kill (cut) everything from the cursor to the end of the line, and Ctrl+Y to paste it back. Same keys in bash and zsh on Mac, Linux and WSL.
| Action | Mac | Windows | |
|---|---|---|---|
| Kill to end of line | Ctrl+K | Ctrl+K | |
| Kill to start of line | Ctrl+U | Ctrl+U | |
| Kill previous word | Ctrl+W | Ctrl+W | |
| Yank (paste) last kill | Ctrl+Y | Ctrl+Y | |
| Move to end of line | Ctrl+E | Ctrl+E |
Cut from the cursor to the end
Press Ctrl+K to delete everything from the cursor to the end of the command line. In readline terminology this is a "kill" — the text is saved to the kill-ring, so Ctrl+Y pastes it back. It works the same in bash and zsh on macOS Terminal, Linux and Windows WSL / Git Bash.
Combine with Ctrl+A
A common move: press Ctrl+A to jump to the start, then Ctrl+K to cut the whole line into the kill-ring — handy when you want to run a quick command and then restore the one you were typing with Ctrl+Y.
Flow-control gotcha
Ctrl+K is never affected by XON/XOFF, so it always works. If it seems to do nothing, check you are not inside a full-screen program (like less or vim) that captures the key for its own use.
FAQ
How do I delete from the cursor to the end of the line in a terminal?
Press Ctrl+K. It cuts everything after the cursor on the current command line and stores it in the kill-ring.
How do I paste back what Ctrl+K deleted?
Press Ctrl+Y to yank the last killed text back at the cursor position.
What is the difference between Ctrl+K and Ctrl+U?
Ctrl+K kills from the cursor to the end of the line; Ctrl+U kills from the cursor to the start.
Does Ctrl+K work on Mac and Windows terminals?
Yes. In bash/zsh on macOS Terminal and in WSL/Git Bash on Windows, Ctrl+K is the readline kill-to-end-of-line.