Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux Terminal: typing feedback gone, line breaks not displayed

From time to time I have to run a command-line tool (a Python script) whose output seems to break my terminal. After the execution is finished, the typing feedback is gone (I can't see what I'm typing), and also line breaks are not displayed. This happens if the terminal is started remotely via Putty, and also locally when using gnome-terminal.

For example, after the problem happens, if I type ENTER pwd ENTER, I would expect to see:

[userA@host006 ~]$ [userA@host006 ~]$ pwd /home/userA [userA@host006 ~]$ 

But actually the output is:

[userA@host006 ~]$ [userA@host006 ~]$ /home/userA                                                              [userA@host006 ~]$ 

The only way to fix it is to close that terminal and start a new one.

Maybe be related: the script output contains some terminal-based formatting (e.g. invert foreground/background to highlight some status messages). If I dump this output to a file I can see things like [07mSome Message Here[0m.

Any ideas what I could do to prevent this?

like image 523
E.Z. Avatar asked Jul 16 '13 17:07

E.Z.


People also ask

Can't see what I'm typing in terminal?

Try a Blind Reset You won't see what you're typing, so do it slowly to ensure you're entering the correct letters. With terminal open, type reset and hit Enter . Alternately, you can type reset -c to just reset the characters responsible for your issue.

How do I reset terminal screen?

You can use Ctrl+L keyboard shortcut in Linux to clear the screen. It works in most terminal emulators.

How do I get back to type in terminal?

Just type Q to get back to the command line, from the help module. Show activity on this post. To exit, press Ctrl + C (twice) or Ctrl + D or type .

What happens when you press Ctrl L in a Linux command console?

Ctrl+L – clears the screen (same effect as the “clear” command). Ctrl+S – pause all command output to the screen. If you have executed a command that produces verbose, long output, use this to pause the output scrolling down the screen. Ctrl+Q – resume output to the screen after pausing it with Ctrl+S.


1 Answers

Execute the command reset and your terminal should be restored (reference).

This issue happens generally when dumping binary data to the terminal STDOUT which when the escape codes received are processed can do anything from change the color of the text, disable echo, even change character set.

The easy way to avoid this is to ensure you do not dump unknown binary data to the terminal, and if you must then convert it to hexadecimal to ensure it doesn't change the terminal settings.

like image 114
Joshua Briefman Avatar answered Sep 22 '22 19:09

Joshua Briefman