16. Bash Shell - Killing And Yanking
Contents
You can cut and paste text through the killing and yanking features provided by the bash shell.
Killing Text Forward
We can use Ctrl K to cut the text behind the cursor:
|
|

before killing

after killing
Killing Text Backward
We can use Ctrl U to cut the text before the cursor:
|
|

before killing

after killing
Killing Word Forward
We can use Alt D to cut the word on or after the cursor:
|
|

before killing

after killing
Killing Word Backward
We can use Ctrl W or Alt Backspace to cut the word before the cursor:
|
|
Or:
|
|

before killing

after killing
Yanking (Pull word or text back from the Kill Ring)
We can use Ctrl Y to pull the killed word or text back from the kill ring.
We use either of the kill commands to demonstrate:
|
|

before killing

after killing
We run the following command to pull killed word back:
|
|

after yanking
References 8.4.4 Killing And Yanking
Author Dong Chen
LastMod Sun Feb 17 2019