Between the quotation marks, you can add the following lines to customize your Terminal prompt:
- \d – Current date
- \t – Current time
- \h – Host name
- \# – Command number
- \u – User name
- \W – Current working directory (ie: Desktop/)
- \w – Current working directory, full path (ie: /Users/Admin/Desktop)
So, let’s say you want your Terminal prompt to display the User, followed by the hostname, followed by the directory, the .bashrc entry would be:
export PS1="\u@\h\w$ "
which will look like:
Admin@MacBook~Desktop/$ "
Cool huh? You can also change the prompt itself to anything, it doesn’t have to be the $ sign, simply replace it with whatever else you’d like to use, : for example would be:
export PS1="\u@\h\w: "
which is the same as above, but : instead of $
Admin@MacBook~Desktop/: "
So, play around and see what you prefer. By the way, if you’re new to the Terminal text editor nano, you save a file by hitting control-o, and you exit the file and program by hitting control-x. You can also just use a standard text editor, like TextWrangler or TextEdit.