Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm on fresh Lubuntu 14.04 installation. I am using LXTerminal and this is the prompt I'm setting through .bashrc file:

export PS1="\e[0;36m$ \w \e[m"

Assume I enter a command up to 15 characters long (and execute so it registers to history) (never mind "command not found"):

$ ~ 012345678901234
012345678901234: command not found

Now if I press up arrow I get my command back:

$ ~ 012345678901234

And if I press down arrow, I'm back to the bare prompt:

$ ~ 

THE PROBLEM The problem starts if I have 16 or more characters to run:

$ ~ 0123456789012345
0123456789012345: command not found

Now when I press up arrow, I am presented with previous command just fine:

$ ~ 0123456789012345

Pressing down arrow doesn't bring me back to bare prompt, it somehow memorizes 10 characters of the first over 16-characters long command in my history and displays it until anything else is run. It basically becomes my default prompt for the time being.

$ ~ 0123456789

I can now press return to get rid of it, or I can run any other command. For the sake of example this:

$ ~ 0123456789ls
Desktop  Documents  Downloads  Music  Pictures  Public  Templates  Videos

What can I do to fix it? It's not that big a deal but it's quite annoying.

share|improve this question
up vote 2 down vote accepted

You need to wrap colour codes in \[ and \]

PS1='\[\e[0;36m\]$ \w \[\e[m\]'

Also, PS1 is only relevant to your interactive shell, you don't need to export it to child processes.

share|improve this answer
Thanks, exactly what I needed. – pythonishvili May 3 '14 at 12:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.