Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm able to change the terminal prefix with PS1="[\\W]$".

However, whenever I restart the terminal or open a new instance, it reverts to the default.

How can I make this change permanent?


Here's the content of ~/.profile file:

share|improve this question
try echo 'PS1="[\\W]$"' >> $HOME/.profile – jm666 Jun 18 '13 at 19:41
Nope, that doesn't work. – Aram Boyajyan Jun 18 '13 at 19:43
@downvotes - what's wrong with the question? – Aram Boyajyan Jun 18 '13 at 19:43
thats works. Simply you need add it into the .profile file. – jm666 Jun 18 '13 at 19:43
Thanks for messages jm666 but it seems to be there already. I just updated the question with contents of my .profile file. – Aram Boyajyan Jun 18 '13 at 19:46
up vote 4 down vote accepted

If both .bash_profile and .profile exist, bash reads only .bash_profile when opening a login shell. So try adding the line to .bash_profile instead.

share|improve this answer
That did the trick - thanks a lot Lauri! – Aram Boyajyan Jun 19 '13 at 12:24
Don't just jam things in .bash_profile. Things you want to apply to all interactive shells should go in ~/.bashrc. Only things you want in login shells should go in ~/.bash_profile. ~/.bash_profile should source ~/.bashrc to pick up the stuff you want in all interactive shells. – Chris Page Jan 11 at 23:20
In particular, login shells can be non-interactive, so avoid doing interactive-shell setup in ~/.bash_profile or the other profile/login scripts. – Chris Page Jan 11 at 23:48

Most Bash shell customizations, including the PS1 shell prompt, should be set in ~/.bashrc, which applies to all interactive shells.

You'll also need a ~/.bash_profile—which should only contain items for login shells—and it should source ~/.bashrc, e.g.,

[ -r ~/.bashrc] && . ~/.bashrc

If you have a ~/.profile it should only contain POSIX-compatible commands and nothing Bash-specific, which means you should prefer to use ~/.bash_profile for login commands when you have a ~/.bashrc for it to source.

share|improve this answer

Your Answer


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.