Created
July 16, 2014 21:07
-
-
Save chadsaun/e0cab20e05b4a95deec9 to your computer and use it in GitHub Desktop.
How to customize your terminal prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type: | |
nano .bashrc | |
Now type: | |
export PS1=" " | |
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/: " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment