Mac .profile .bashrc terminal set prompt custom
Posted under » Mac on 5 March 2010
Whether you use the Terminal occasionally or regularly, you might find it appropriate to change the way it looks beyond the color scheme and transparency settings. How about changing the actual command line prompt?
To set prompt im Mac you have to use this command.
export PS1="QQ"
Replace the QQ with
- \d - Current date
- \t - Current time
- \W - Current working directory (ie: www/)
- \w - Current working directory, full path (ie: /Users/Admin/www/)
- \h - Host name
- \u - User name
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="I rock \u@\h\w ->" I rock Admin@MacBook/Users/Admin/www/ ->
If you happen to like a particular prompt and want it permanent, you have to put it inside the shell config. Although you are using bash, in MacOS instead of changing the .bashrc file, you have to change the .profile file instead located at the user ~ (home) directory. You might have to create a new one since there is none by default.
