MacOS命令行终端隐藏电脑名和用户名的方法

https://www.jianshu.com/p/a1c3fb4f2b63

另外还有一个方法,是我感觉更纯粹的设置方式:

vim ~/.bash_profile

打开配置文件后,在最后一行下面添加如下代码:

export PS1="[\u@\h \W]\$ "

然后让配置文件立即生效,执行以下命令:

source ~/.bash_profile

说明一下:
\u – 当前用户名
\h – 主机名hostname
\W – 当前目录
\w – 当前目录的完整路径
\d – 现在的系统日期
\t – 现在的系统时间

猜你喜欢

转载自blog.csdn.net/muyimo/article/details/111050232