Friday, May 3, 2024
45
rated 0 times [  45] [ 0]  / answers: 1 / hits: 22257  / 1 Year ago, mon, march 27, 2023, 7:33:12

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.)


More From » command-line

 Answers
1

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.


[#43780] Wednesday, March 29, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ouschee

Total Points: 485
Total Questions: 88
Total Answers: 106

Location: Central African Republic
Member since Mon, Aug 10, 2020
4 Years ago
;