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 have defined a PS1 prompt multi-line in my server with Ubuntu 11.04.
The problem occurs when I write a long command, the line cuts before the end of terminal and it continues at beginning the same line:
screen capture 1

But if I continue writing the line ends at the end of window and it continues in next line, as expected:
screen capture 2

And if I press Home key the cursor goes to the line above the first line.

I connect to server with SSH in a gnome-terminal.

The PS1 line in /etc/bash.bashrc is:

[ $UID -eq "0" ] && PS1="\e[31m┏━\e[42m┅◉ \e[37m\d ⌚ \t \e[31m┅\e[0m\e[31m━━\e[42m┅◈ \e[37m\H \e[0m\n\e[31m┣\e[0m \w (\e[36m\$(ls -1 | wc -l) fichero/s\e[0m) \n\e[31m┗\e[45m┅◉\e[1;37m \u \e[0m\e[31m━► " || PS1="┏━\e[44m┅◉ \e[37m\d ⌚ \t ┅\e[0m━━\e[44m┅◈ \e[37m \e[0m\n┣━━\e[42m┅◉ kernel: \e[37m$(uname -r) ┅\e[0m━━\e[42m┅◈ uptime: \e[37m$(date -d "`cut -f1 -d. /proc/uptime` seconds ago" +"%a %d %b %R") \e[0m\n┣ \w (\e[36m\$(ls -1 | wc -l) fichero/s\e[0m) \n┗\e[46m┅◉\e[1;37m \u \e[0m━► "

Some of the environment variables:

$ env
LESSOPEN=| /usr/bin/lesspipe %s
LESSCLOSE=/usr/bin/lesspipe %s %s

Any idea?

share|improve this question
Does this occur with the normal PS1 variable? – James Oct 17 '11 at 0:02
It's the PS1 that's the problem. When I try it here, I get the same issue. – Oli Oct 17 '11 at 0:37
up vote 3 down vote accepted

Here I fixed it for you :

Here the first one :

PS1='\[\e[0;31m\]┏━\[\e[42m\]┅◉ \[\e[0;37m\]\[\e[42m\]\d ⌚ \t \[\e[0;31m\]┅\[\e[0m\]\[\e[0;31m\]━━\[\e[42m\]┅◈ \[\e[0;37m\]\[\e[42m\]\H \[\e[0m\]\n\[\e[0;31m\]┣\[\e[0m\] \w (\[\e[36m\]$(ls -1 | wc -l) fichero/s\[\e[0m\]) \n\[\e[0;31m\]┗\[\e[45m\]┅◉\[\e[1;37m\]\[\e[45m\] \u \[\e[0m\]\[\e[0;31m\]━► '

And the second one :

PS1='┏━\[\e[44m\]┅◉ \[\e[0;37m\]\[\e[44m\]\d ⌚ \t ┅\[\e[0m\]━━\[\e[44m\]┅◈ \[\e[0;37m\]\[\e[44m\] \[\e[0m\]\n┣━━\[\e[42m\]┅◉ kernel: \[\e[0;37m\]\[\e[42m\]$(uname -r) ┅\[\e[0m\]━━\[\e[42m\]┅◈ uptime: \[\e[0;37m\]\[\e[42m\]$(date -d "`cut -f1 -d. /proc/uptime` seconds ago" +"%a %d %b %R") \[\e[0m\]\n┣ \w (\[\e[0;36m\]$(ls -1 | wc -l) fichero/s\[\e[0m\]) \n┗\[\e[46m\]┅◉\[\e[1;37m\] \u \[\e[0m\]━► '
share|improve this answer
Thank you very much. I didn't know that it was necessary to enclose the color codes between brackets. – Juan Simón Oct 17 '11 at 14:37

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.