The same way we added colors to the text in terminal application in Mac OS X, you can change the default shell prompt to something more meaning full to your needs. By default it looks something like this:
enekochans-Mac-mini:Users enekochan$
As you can see it is defined as:
"host name":"current working directory" "user name"$
You can change it by modifiying the $PS1
system variable. Those a some of the placeholders but there are a lot more:
- \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)
You can guess that the default value of $PS1
is configured as follows:
EXPORT PS1="\h:\W \u\$ "
You can set you own value in ~/.bashrc
or ~/.bash_profile
.
You can also change the default interactive prompt for a multi-line command which is “>” by changing $PS2 system variable.
Ref: http://www.thegeekstuff.com/2008/09/bash-shell-take-control-of-ps1-ps2-ps3-ps4-and-prompt_command/
http://osxdaily.com/2006/12/11/how-to-customize-your-terminal-prompt/