Take the 2-minute tour ×

In Bash, when I am typing a command, I press Ctrl+U, all characters from the beginning of the line to the cursor are going to be removed. However, in zsh, if I pressed Ctrl+U, the whole line is gone.

How to do the same in Zsh as in Bash?

share|improve this question
Actually, this is an Emacs hotkey, not bash. Bash reuses lots of the Emacs key bindings. Some other Emacs key bindings to zsh: code.google.com/p/vinipsmaker/source/browse/config/… –  vinipsmaker Feb 22 at 18:50

1 Answer 1

up vote 23 down vote accepted

It sounds like you'd like for Ctrl+U to be bound to backward-kill-line rather than kill-whole-line, so add this to your .zshrc:

bindkey \^U backward-kill-line

The bindkey builtin and the available editing commands (“widgets”) are documented in the zshzle man page.

share|improve this answer
Zsh doesn't use readline, instead it uses its own zle. So i am gonna customize the keybind. thanks! –  Kent Aug 14 '10 at 15:38

Your Answer


