MacOS – Changing the command prompt of Terminal

bashmacosterminal

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.

Best Answer

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"