I would like to change the formatting on my BASH prompt from this:


to something like this:


The idea is that I would be able to type a reasonably long command on one line without it wrapping to the next line so quickly.

migrated from stackoverflow.com May 11 '10 at 5:27

This question came from our site for professional and enthusiast programmers.


Just add \n to your PS1 definition, for example, to change the default colour prompt that is included in Debian do this

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\n\$ '

  • Yeah, I just noticed that on another SO thread. Thanks. – Robert S. Barnes May 6 '10 at 9:59

Use the following line, which you can place in your ~/.profile

export PS1="\u@\h:\W\n\$"

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.