1

Currently my terminal prompt looks like:

blankman-MacBook-Pro:~ $

My .bash_profile has:

export PS1="\[\033[36m\]\h:\W \[\033[33m\]\$(parse_git_branch)\[\033[00m\]\$(git config user.initials)$\[\033[00m\] "
export SUDO_PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[0m\]'

Does this make sense?

0

1 Answer 1

7

That PS1 variable is for customizing the display of the shell "prompt". The prompt is the text that appears when the terminal first opens, or at the end of every command (you can repeat the terminal prompt any number of times by repeatedly pressing enter at the terminal with no command).

The PS1 variable appears to be looking at your git user id and branch to determine your prompt. This can be useful if you're within a git branch because it'll tell you which branch you're on.

If you didn't do this, then probably some program did. If you are having a particular problem with your terminal prompt or want to change it to something else, you can. But asking "does this make sense" is not really answerable: all we can do is ask more questions:

  • Where did it come from? A program you installed? A script someone wrote? You?
  • Do you use git? If not, you may not need this customization.
  • Do you dislike the current prompt and want to change it to something else, or are you satisfied with it as it is?

It's all a matter of preference; there is no "correct" or "incorrect" terminal prompt. You could have it display :-) if you wanted to. It'd be perfectly valid.

3
  • sorry, i just don't want 'myname-macbook-pro' to be prefixed, not sure where that is coming from? is it from the PS1 script above? Can I change my computer name somewhere that will update this also?
    – Blankman
    Sep 12, 2012 at 2:03
  • 1
    You can customize the prompt however you like. The "myname-macbook-pro" is basically your username and your hostname. You can customize the hostname with the hostname command or by editing /etc/hostname. See this article for detailed information on how to create your own custom prompt format. Sep 12, 2012 at 2:09
  • The host name in the prompt comes from the \h close to the start of PS1. Removing that should address that, although it can be quite useful to have the host name in the prompt if you regularly ssh into remote systems. Sep 12, 2012 at 3:50

You must log in to answer this question.

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