In Bash and Zsh ctrl+w erases backwards from where the cursor is. Is it also possible to undo what I had erased?
Thanks!
14 Answers
Undo it's like this :ctrl + _
7It's ctrl + /
ctrl + y (or _) pastes what's in the buffer. The buffer get's filled by things like ctrl + w. You can paste it in different places multiple times, so it's not an "undo". ctrl + / is undo, and you can execute it multiple times to undo every consecutive previous action.
This below shortcut key does the job of undo the erased string by ctrl+w,
ctrl+y
3ctrl+w does not delete but cuts everything in front of the cursor. Therfore you can yank/paste it with ctrl-y assuming you did not move the cursor. ctrl+_ actually restores the line itself.