When I type long commands in bash the text begins overwriting the current line from start, that is some thing weird.
I have figured out that that is actually because of bash profile settings in ~/.bashrc file
After searching on google I came to answer from stackexchange explaining the scenario as follow
Non-printable sequences should be enclosed in \[ and \]. Looking at your PS1 it has a unenclosed sequence after \W. But, the second entry is redundant as well as it repeats the previous statement “1;34”.
\[\033[01;32m\]\u:\[\033[01;34m\] \W\033[01;34m \$\[\033[00m\]
|_____________| |-|
| |
+--- Let this apply to this as well.
As such this should have intended coloring:
\[\033[1;32m\]\u:\[\033[1;34m\] \W \$\[\033[0m\]
|_____|
|
+---- Bold blue.
Keeping the "original" this should also work:
\[\033[1;32m\]\u:\[\033[1;34m\] \W\[\033[1;34m\] \$\[\033[0m\]
|-| |-|
| |
+-----------+-- Enclose in \[ \]
so to implement it, open your ~/.bashrc file and replace the PS1 values as follow
PS1='\[\033[1;32m\]\u:\[\033[1;34m\] \W\[\033[1;34m\] \$\[\033[0m\] '
enjoy 😉
Recent Comments