Edit your Bash prompt in OSX

If you ever get bored, or even want to make the bash prompt more functional, follow me:

As with my tip about creating an alias for ls so that it is always color coded, edit the .bash_profile file for the user in question and add:

PS1='                     ***Adds a line break between the prompt and the previous line
\u@$PWD            ***Will add the current user and print the current working directory
==> '                      ***Will add ==> before the input cursor

There are a multitude of additional options that could be set; this is just what I prefer.  Also, if you want this feature to be persistent through to the root user simply add the following to .bash_profile

alias sudo='sudo bash --login'

This will keep your current user's .bash_profile changes active for the super user.  Just keep in mind that you will stay logged in as superuser until you type 'exit', but then the changes you just made to your prompt will remind you who you are running as :-)

Comments

Popular Posts