0
p_ash-3.2$ cp some_file1234.html /some/loc/ation/ofthe/some_file1234.html.html_Backu

Have been seeing this intermittent issue with the command-line, while typing longer lines as part of any command, after typing some characters, say about 70, it starts all over again, from the extreme left, even before the -bash-3.X$ consequently the prompt and first few characters of the command itself gets overwritten, why would this happen, any workaround?

2 Answers2

2

shopt -s checkwinsize in bash can fix this problem sometimes, it arises when the remembered window size differs from the current size. Granted this is usually only an issue with graphical terminals, e.g. konsole mate-terminal, etc.

hanetzer
  • 488
1

Could be a carriage return (\r) in the destination file name.

EDIT: Any chance you previously had your terminal settings messed up? This can happen if you by accident cat a binary file on your terminal. One way to fix that is

 stty sane

Another reason might be that a SIGWINCH got lost when you resized the terminal window. In that case, another resize usually fixes the problem.

Jens
  • 1,752
  • 4
  • 18
  • 36
  • Didn't see any, any other reason? :( – Keyshov Borate Mar 04 '15 at 12:26
  • @Keys Anything funny going on with the number of columns? Try stty -a and echo $TERM $COLUMNS. – Jens Mar 04 '15 at 12:29
  • rows 44; columns 168; Shouldn't be a problem. – Keyshov Borate Mar 05 '15 at 06:34
  • Once, I do remember of performing cat on a binary which changed the title of the PuTTY window too with some unreadable content, why was that and how would it affect the $COLUMNS, any preventions in place to avoid this? – Keyshov Borate Mar 05 '15 at 06:41
  • 1
    @Keys There's no prevention from cat'ing binary files other than don't do that. Any modern terminal supports Escape sequences to change a variety of settings. Binary files may contain just the right bytes to mess up the terminal's notion of the number of lines and columns. stty sane is one way to get the terminal back into shape so you at least can see what you type (yes, terminals can be told to not echo typed characters. That's what passwd does.) – Jens Mar 05 '15 at 08:19