Centos – Server Bash Line Wrapping Over Text & In Wrong Place

bashcentosmac-osxshellterminal

This is quite a hard problem to explain, when connecting to one of my servers using the bash shell, under any user the line wrapping is broken and has all sorts of problems. Once of which I detail in screenshots below: enter image description here

Part2

Part3

Part4

Other problems I experience include nano getting very confused about which line and or letter I am on, as shown by typing the same message into nano:

Nano is broken

These problems only occur when connecting as I previously mentioned to one of my servers which runs CentOs. Do you know why this is occurring and what I can do to fix it? On other servers the message works fine!

Other server working

Thanks for your time,


Output of requested commands:

Server that doesn't work properly:
Not Working Sever

Working server:

Server that works


Could it perhaps be the custom prompt on the non working server? In .bashrc

PS1='\e[1;32m\u@\h\e[m:\e[1;34m\w\e[m$ '

Commenting this out appeared to resolve the problem.

Google says line wrapping errors can occur if you don't conform to these rules

use the \[ escape to begin a sequence of non-printing characters,
and the \] escape to signal the end of such a sequence

I am not sure where this would fit in on my prompt?

Best Answer

The custom prompt is the issue (from your comments).

PS1='\e[1;32m\u@\h\e[m:\e[1;34m\w\e[m$ '

It's either sending a control sequence your terminal doesn't understand or it's not well formed.

You could try this,

PS1='\[\e[1;32m\]\u@\h\[\e[m\]:\[\e[1;34m\]\w\[\e[m\]$ '