Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to try vi mode in bash but now I would like to change it back to normal.

How can I unset -o vi ?

share|improve this question
up vote 15 down vote accepted

The only two line editing interfaces currently available in bash are vi mode and emacs mode, so all you need to do is set emacs mode again.

set -o emacs
share|improve this answer
It should be noted that this was me reading between the lines rather than answering the question directly. emacs is the default line editing mode in bash. Setting emacs mode disables vi mode as a side effect, but as mentioned by jlliagre below, you can actually disable them both. – Chris Down Dec 25 '12 at 11:37

That depends on what you define "normal". If that's turning off line editing, the documented way to unset -o vi is to set +o vi

$ set -o vi
$ set -o|egrep -w "(vi|emacs)"
emacs           off
vi              on
$ set +o vi
$ set -o|egrep -w "(vi|emacs)"
emacs           off
vi              off

Chris has already answered if your normal mode is emacs.

share|improve this answer
turning off the mode(s) also takes away the shell history feature, now I cannot use up/down arrow keys to see command history :( – rsjethani Dec 24 '12 at 21:39
It doesn't take away the shell history feature. You can still view your history with the history command and run previous commands by prefixing their number with the ! character. – jlliagre Dec 24 '12 at 22:53
yes 'history' n family commands still work but the up/down arrow keys which I use more frequently do not work. As soon as I turn any of the modes on keys start working...I don't understand? – rsjethani Dec 25 '12 at 7:57
The up/down arrows are only managed by the shell if line editing is enabled (i.e. one of emacs or vi mode is set). Otherwise, the arrows keys just send their escape sequence unprocessed. – jlliagre Dec 25 '12 at 9:59
thanks jlliagre :) – rsjethani Dec 25 '12 at 15:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.