2015-11-14 62 views

回答

2

您可以自定义PS1变量~/.bash_profile文件。例如,这是我的:

export PS1='\[\e[32;1m\]\h:\[\e[31m\]\W \[\e[32;1m\]\u\[\e[0m\]\$ ' 

的令牌是:

\e[32;1m\] - the color green 
\h   - host name (i.e. the computer's name) 
:   - the literal colon (:) character 
\e[31m\] - the color red 
\W   - current working directory 
\u   - user name 
\e[0m\]  - the color black 
\$   - normally display the dollar sign, change to # when logged in as root 

Reference。 Google为“ps1提示生成器”提供帮助您对其进行配置的工具。这是我的提示样子:

enter image description here

+0

谢谢你!它适用于终端和iTerm,帮助我很多。 – juanpazos

相关问题