I am using Ubuntu G-NOME 16.04. Line wrapping not functioning properly in my terminal. It starts rewrite at the beginning of the same line.
If I try to type follwining command
user@MY-PC: ~$/home/user/abc/def/configuration/config.file

It will go something like:
config.file ~$/home/user/abc/def/configuration/

instead of:
user@MY-PC: ~$/home/user/abc/def/configuration/

my PS1 variable in .bashrc is

Please someone help


Escape sequences that don't advance the cursor (e.g. \e[0;34m to change color) need to be enclosed between \[ and \] in PS1.

This is described in the "PROMPTING" section of bash's manual page.

  • I tried but it did not work. – shubham12511 Jun 2 '16 at 6:40
  • Care to share the PS1 you tried? – egmont Jun 2 '16 at 10:30
  • PS1='${debian_chroot:+($debian_chroot)}[\e[0;34m]\u\e[[0;35m]@[\e[0;92m]\h:[\e[0;96m]\w[\e[0;31m]\$[\e[0m]' – shubham12511 Jun 2 '16 at 10:40
  • I said \[ and \], not [ and ]. Also, \e[[0;35m] misplaces the opening tag. Do it carefully and precisely and it'll work. (Btw this question has probably a dozen duplicates here on stackoverflow. I'm outta here, can't help you any further in this easy step.) – egmont Jun 2 '16 at 11:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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