Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've learned a neat trick in school to make your terminal prompt text look more pretty, eg.

export PS1="(\h) \u \w "   

gives me

(brendt-ubuntu) brendt ~ 

The issue happens when I try to color these things, some weird text overflow bug appears:

This is without colors

enter image description here

This is with colors

(export PS1="\e[1;34m(\h)\e[m \u \e[1;34m\w \e[m")  

enter image description here

Are there any fixes for this?

share|improve this question

1 Answer 1

I fixed it using proper color coding:

PS1="\[\033[01;34m\](\h)\[\033[00m\] \u \[\033[01;34m\]\w \[\033[00m\]"
share|improve this answer

Your Answer

 
discard

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.