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.

1 Answer 1


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"

  • 1
    Also, I had to use \W instead of \w, because CentOS shows just the directory name, not the path.
    – Ryan
    Jul 2, 2013 at 4:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .