Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

For example, when I type following command,

echo line | (cat >/dev/null; vi)

even wrapped in another shell,

sh -c 'echo line | (cat >/dev/null; vi)'

and returned from Vim, now it won't display carriage return any more.

How can I do to make it again display the new lines? (Without exit.)

share|improve this question
obligatory switch-to-emacs remark :) – Dang Khoa Aug 21 '11 at 3:42
up vote 10 down vote accepted

try one or both of these:

  • type ctrl+c, then type reset, then press enter.
  • type ctrl+c, then type stty sane, then press enter.

the ctrl+c is to clear any other characters you might have typed in the command line.

reset or stty sane usually fixes a messed up terminal. Read the man page of reset and stty for more information.

Note that if the terminal is messed up enough then it might be that not even ctrl+c or enter will work as expected. There are still other methods to input characters, but they involve ancient dark magic. In that case, it is usually easier to just close the terminal and start another one.

My understanding of the inner workings of a terminal is not deep enough to explain why or how it does that.

share|improve this answer

It is not the intended use for vi to take input from stdin.

Anyway, you can get newlines again with

stty sane

without resetting the terminal.

share|improve this answer

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.