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 opened iTerm2 and it changed the prompt to..

[33[01;32m]u@h[33[00m]:[33[01;36m]w[33[00m]$

I have no idea how this happened, and I can't figure out how to change it. I went to terminal to see if I had the same problem, and it shows the same prompt :/

I did a Google search and it brings up info about Vim, which I have never used, so I'm a little confused. Other people use my computer to help me though, so maybe someone switched something on accident. I'm using a MacBook running 10.8.4.

share|improve this question

migrated from stackoverflow.com Aug 24 '13 at 21:06

This question came from our site for professional and enthusiast programmers.

    
That output is controlled by your PS1 variable. It is trying to set the colors for your prompt. However it seems those aren't the right escape codes. Did you change your $TERM variable. (Probably should be xterm or xterm-256color) You should be able to change it in the menus for iterm2 (However I can't tell you which as I'm not sitting front of iterm2 right now) –  FDinoff Aug 23 '13 at 21:13
    
Thanks @FDinoff for leading in me the right direction. This website guided me through the problem, which was a bash profile: mattmazur.com/2012/01/27/… –  alex Aug 23 '13 at 21:33

2 Answers 2

If your prompt is broken, here are the files you should check for any statements containing PS1:

  • ~/.bash_profile
  • ~/.profile
  • /etc/profile

At least on OS X, those are where you'd typically alter your interactive prompt. If only your prompt is broken, and not the entire shell, it should be easy to edit the files in a normal text editor, e.g.

open -e ~/.bash_profile

Remove any offending lines that set PS1, save the configuration file, and restart your shell.

share|improve this answer

They are colour sequences and here is what I have in my .bash_profile

  BLACK='\e[0;30m'
  BLUE='\e0;34m'
  BROWN='\e[0;33m'
  CYAN='\e[0;36m'
  DARKGRAY='\e[1;30m'
  GRAY='\e[0;37m'
  GREEN='\e[32m'
  LIGHTBLUE='\e[1;34m'
  LIGHTCYAN='\e[1;36m'
  LIGHTGRAY='\e[0;37m'
  LIGHTGREEN='\e[1;32m'
  LIGHTPURPLE='\e[1;35m'
  LIGHTRED='\e[1;31m'
  PURPLE='\e[0;35'
  RED='\e[0;31m'
  YELLOW='\e[1;33m'
  NC='\e[m'

#  Variables PCT and PS1 can be merged into a new PS1 variable:
  PS1="\`if [[ \$EUID -eq 0 ]]; then PCT='\[$LIGHTRED\]';
  else PCT='\[$LIGHTCYAN\]'; fi;
  echo '\[$NC\]['\$PCT'\u\[$YELLOW\]@\[$GREEN\]\h:\w\[$NC\]]\[$GRAY\] : \[$NC\]'\`"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.