可以利用修改环境变量 PS1 来修改终端提示文字,例如
$ export PS1="\u@\h:\W$ "
将上述命令增加到 ~/.bashrc
文件中。
变量 PS1 中的变量及其的具体含义如下
- \d – Current date
- \t – Current time
- \h – Host name
- # – Command number
- \u – User name
- \W – Current working directory (ie: Desktop/)
- \w – Current working directory with full path (ie: /Users/Admin/Desktop/)