Contents|Index|Previous|Next

Readline Killing Commands

Killing text means to delete the text from the line, but to save it away for later use, usually by yanking it back into the line. If the description for a command says that it ‘kills’ text, then you can be sure that you can get the text back in a different (or the same) place later. Thefollowing is the list of commands for killing text.

C-K
Kill the text from the current cursor position to the end of the line.

M-D
Kill from the cursor to the end of the current word, or if between words, to the end of the next word.

M-Delete
Kill from the cursor to the start of the previous word, or if between words, to the start of the previous word.

C-W
Kill from the cursor to the previous whitespace.

This is different than M-Delete because the word boundaries differ.

And, here is how to yank the text back into the line.

C-Y
Yank the most recently killed text back into the buffer at the cursor.

M-Y
Rotate the kill-ring, and yank the new top. You can only do this if the prior command is C-Y or M-Y.

When you use a kill command, the text is saved in a kill-ring. Any number of consecutive kills save all of the killed text together, so that when you yank it back, you get it in one clean sweep. The kill ring is not line specific; the text that you killed on a previously typed line is available to be yanked back later, when you are typing another line.