Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have found myself to grow fond to CentOS's command prompt which looks like the following:

 [user@host directory]$ cmd

I, personally, do not like how Mac OS X Terminal is laid out, which is:

 host:directory user$ cmd

Is there any way to change the prompt of Terminal's commands to make it look more like the first one? I am very new to these things.

share|improve this question
up vote 5 down vote accepted

If you are using bash, simply do PS1='[\u@\h \w]$ '

More details and options in man bash (search for PROMPTING)

If tcsh, do man tcsh and search for "prompt"

share|improve this answer
That worked perfectly! Thank you! – rtainc Jul 2 '13 at 4:16
Also, I had to use \W instead of \w, because CentOS shows just the directory name, not the path. – rtainc Jul 2 '13 at 4:27

Your Answer


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.