Reputation: 9479
I'm a n00b trying to permanently change my terminal prompt.
I've used the following tutorials/threads:
http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
I've managed to change the .bashrc file:
$ cat .bashrc
export PS1="\w $"
but the prompt is still not coming up the way I want it.
On temporary basis the following works:
$ PS1="\w $"
~ $
Am I editing the wrong file?
Upvotes: 2
Views: 6528
Reputation: 289585
Two suggestions:
.bashrc
file, unlog and log again to see if it works..profile
, as .bashrc
is only used if you have /bin/bash
as your default shell.Upvotes: 1
Reputation: 979
I am only answering this here because I just searched for the solution to this problem today and this thread popped up near the top. I figured i'd give an ultimate noob guide for "how to" get this done on Mac, as i like things written out very detailed =P
.bash_profile
which is a hidden file. The reason why you change this file is because this is the one that is loaded every time you start up the bash shell. But before doing this make sure you have told bash that you want hidden files to be displayed (you how to hide them after):
Copy/Paste into Terminal:
defaults write com.apple.finder AppleShowAllFiles TRUE
followed on a new line by:
killall Finder
After making all files visible, you must then navigate into the main user-directory located at HD > Users > YourUserName
. Once you're inside, locating the .bash_profile
file should be relatively easy. Drag the bash file over to your preferred text editor. This is where you will add the commmand (or your own custom variation):
export PS1="\w $"
Once you are satisfied with your changes, you need to save and restart bash in order for them to take effect. In order to hide files that were made visible earlier, copy/paste the follow two lines subsequently into your terminal:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
Upvotes: 3