Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.