2

This question already has an answer here:

After running a bash script, my (gnome-)terminal ended up printing each new line where the last one ended (but on the next row). I think it was printf that broke things, since it works if I replace printf with echo. Have you any idea what this could be, and how to fix it without having to close the terminal session?

Broken newlines

I can not provide the script, because of security reasons. When I have time I will see if I can create a minimal broken example to show.

marked as duplicate by jasonwryan, cas, Romeo Ninov, Wouter Verhelst, roaima Jan 18 '18 at 19:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Most likely something in your script changed stty settings. If you log out and back in in should be okay. Or type stty sane^J (^J meaning ctrl-j) at the command line. – Deathgrip Jan 18 '18 at 7:22
  • as well as the answers in the dupe link, many terminal emulators have a "Reset" option in a right-click menu, or in the Edit menu. – cas Jan 18 '18 at 7:49
  • 1
    type 'reset' in the terminal – rajaganesh87 Jan 18 '18 at 8:33
  • 2
    @lindhe, I don't think the command called reset does anything other than print some control codes to reset the terminal, it shouldn't affect the shell's history. It does clear the screen, though, but with garbage like that on-screen, that shouldn't matter. – ilkkachu Jan 18 '18 at 9:45
  • 2
    This isn't control codes. This is the line discipline, and the duplicate questions are in fact unix.stackexchange.com/questions/366423 , unix.stackexchange.com/questions/298037 , unix.stackexchange.com/questions/282514 , and unix.stackexchange.com/questions/346363 , amongst others. This has been asked and answered many times. – JdeBP Jan 18 '18 at 10:35