Add PWD to Bash Default

I grew up with DOS, so call me a throwback user, but when I open Bash on my Mac, I’d really like to know where the heck I am. By default, the prompt shows your computer’s name, then the name of the directory you’re in. This works fine if you never have duplicate directory names, but when I’m doing dev work, I often have multiple windows open for staging/prod/dev work, and they all have the same name as they’re supposed to. This script goes into your ~/.profile file and will change bash to show something like

~/Documents/Workspace/
>

Here’s the code you put into your ~/.profile file (create one if you need to):

PS1="\[\033[0;32m\]\w/\n\[\033[0;0m\]>"

Leave a Reply

Your email address will not be published. Required fields are marked *