My shell environment is bash and desktop environment is LXDE. When I use the up and down button on the keyboard to view the command history on bash shell, many times part of the command from the history remains on the line. For example
/home/milhan > ssh somedomain.org
/home/milhan >
then when I traverse the history of commands with up arrow key and come back to command prompt, the prompt looks like
/home/milhan > ssh
and when I press backspace it doesn't delete the ssh. I wasn't able to figure this out for long time. This only happens on my local machine. I ssh to other remote Unix machines where I use bash, but the same annoyance doesn't happen on those machines. I use QTerminal 0.7.1 and the default LXTerminal on my local Fedora Linux pc. Thanks.
I am guessing: On the problem box, there is a spurious non-printing character in the environment variable(s) you have defined. I do not know what you have defined, but if you have local (Ex: .bashrc) files or other "hidden" files sprinkled around you have to validate them to locate where you picked up the garbage.
Start with your home directory.
set | od -c # check your existing variables for junk
od -c [ .filename ] # check your initialization and setup files
That's hard to say. The above example was just to illustrate the problem. It doesn't do it for every command and when it does, it is always 3 characters. For example, I just tested and the gre from a previous grep command was left in the command prompt.
---------- Post updated at 13:17 ---------- Previous update was at 12:23 ----------
It's the three non-printing terminal reset characters at the end of the PS1 string that increase the char count output and thus the "length" of the prompt string that the shell takes into account. Try embedding those by enclosing in the correct codes. man bash :