Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed iTerm 2 but my shell windows show:

"computer name":"current directory" "user" $

This is far too long. I'd like to just see:

"current directory" $

Is there an option for this? I couldn't find it in the preferences.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It's behavior of your shell, not your terminal. If you're using bash, edit ~/.bash_profile and add the following line:

export PS1='\w \$ '

This will display the current working directory, or ~ in case of $HOME, and either $ or #, depending on whether you're root. Examples:

/Applications $
~/Documents $
/Users/danielbeck/Documents #

Search man bash for PS1 to find out about the possible placeholders. You can execute shell scripts as part of your prompt, e.g.:

export PS1='$( pwd ) \$ '

This will behave similar to the one above, but always print the full path.

share|improve this answer
    
Thanks, that did it! –  bruno Aug 15 '11 at 9:54

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.