Mac下终端配置文件与Linux相同,在用户当前目录的.bash_profile文件中,通过修改这个文件,设置PS1环境变量,实现终端样式的设置。
- 打开.bash_profile
open ~/.bash_profile
- 修改.bash_profile
export PS1="\[\033[0;31m\]\u\[\033[00m\]@\[\033[0;32m\]\h\[\033[00m\]\[\033[0;33m\][\t]\[\033[00m\]:\[\033[0;31m\]\w\[\033[00m\]\n\$ "
- 使.bash_profile生效
source .bash_profile
- 效果图