3

Sometimes (rarely) it happens that when I hit enter on a terminal, the command prompt doesn't go to the next line, but it gets printed again on the same line.

My work around is to simply close the terminal and open a new one. Is there any way to avoid this?

Steps to reproduce:

  1. try to log into mongo with authentication enabled, so that you get the prompt to enter the password, like so: mongo --authenticationDatabase somedb -u someuser -p,
  2. then in the password prompt that is shown, hit ctrl+c, voila, now everything is on same line
4
  • 1
    Is there a way to reproduce it?
    – Braiam
    Nov 8, 2013 at 13:29
  • I couldn't find out the cause. I last got this behaviour a few minutes ago when I tried to open ipython and then pressed CTRL+C before it could open, but now I tried again and it works. I don't know, but it's not the first time it happened. Nov 8, 2013 at 13:47
  • I dare to say that your system is just slow...
    – Braiam
    Nov 8, 2013 at 13:50
  • @Braiam incase you are interested, this just happened for me, steps to reproduce (verified by following these thrice!): try to log into mongo with authentication enabled, so that you get the prompt to enter the password, like: mongo --authenticationDatabase somedb -u someuser -p, then in the password prompt, hit ctrl-c, voila, now everything is on same line
    – bool.dev
    Nov 4, 2016 at 12:55

2 Answers 2

5

Use the reset command.

See man reset:

When invoked as reset, tset sets cooked and echo modes, turns off cbreak and raw modes, turns on newline translation and resets any unset special characters to their default values before doing the terminal initialization described above. This is useful after a program dies leaving a terminal in an abnormal state.

It's useful for lots of situations where the terminal is acting up, like if a script has turned off local echo and died before turning it back on so you can't see what you're typing at the prompt...

0

The next time you have the issue type ctrl+c and it will end the command typed. This may help, let me know what happens.

You also want to make sure what you are typing is being input correctly; that may be why it is catching.

1
  • I typed ctrl+c when it happened... it didn't help. Nov 8, 2013 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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