I am using Ubuntu 14.04 and I am having a character problem with my terminal.

This is my terminal when I write a short command and this is my terminal when I write a command with more than the characters that can fit in a line.

I tried changing various fonts and I still get the same problem. I also tried changing font size but still nothing.

Also if I write a command that is like the second link and then I try to delete characters then things get really ugly.Once I start deleting characters then the rest of the line just disappears but if I press enter then the command is interpreted correctly.

What should I do?

  • Do you remember what you were doing prior to this 'bug' appearing? Does the 'reset' command change anything? – Tobias Nov 20 '14 at 9:35
  • the reset command doesn't do anything. I have been having this problem for at least 3 weeks. It just started getting annoying. – sokras Nov 20 '14 at 9:46

What terminal is this? Add the output of echo $TERM to your question.

This can happen when you have escape sequences (as generated by tput) in your prompt that are not surrounded by \[ and \]. Those backslashed brackets tell Bash that the escape sequences do not take up any horizontal space on the screen. Without them around the escape sequences, Bash counts each byte of the escape sequence as a visible character, which messes up previously displayed commands as you move back and forth through command history.


To check if you have escape sequences in your prompt, use echo "$PS1" | od -c and lookfor characters with the value 033. If you spot those, then you have escape sequences in your prompt.

If you find 033 in your prompt

Check where the prompt PS1 is set: grep -i ps1 .*|less

Then edit that file (often it's in .bashrc)and surround the sequence with \[ and \].

  • the terminal I showed is xterm and yes i indeed have the value 033. how can I fix this? – sokras Nov 20 '14 at 9:43
  • Should be able to reset it with reset tput – Tobias Nov 20 '14 at 9:49
  • Edited answer to actually include the fix. – Jan Nov 20 '14 at 10:26
  • @Tobias reset tput give mes this: reset: unknown terminal type tput Terminal type? Then I type in xterm but nothing happens. @Jan How can I check where the PS1 is set? I input the command that you give above and it gives a lot of lines. What should I look for? In a lot of lines it says PS1= ... – sokras Nov 20 '14 at 10:45
  • @sokras The output you get should be in the following format: filename:string Where filename is the name of the file that contains the string, and string is the actual text that includes 'ps1'. All the lines that contain PS1= should begin with a filename. Could you give us those filenames? – Tobias Nov 20 '14 at 13:06

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.