Mac切换终端至Oh My Zsh后,保留原/bin/bash终端显示名
Mac切换终端至Oh My Zsh后,保留原/bin/bash终端显示名
原生终端
也就是使用的是/bin/bash
\h表示本地主机名 \W表示当前目录 比如~ \u表示用户名 $表示符号$
写在~/.bash_profile即可 个人不喜欢显示本地主机名,感觉太长了,也没什么用。显示出用户名和当前目录就可以了
cd ~
vi .bash_profile
export PS1='\u:\W \$ '
source .bash_profile
Oh my zsh
现在很多人用的 这个了,Mac的默认终端也改成/bash/zsh
今天第一次使用Oh my zsh,然后发现终端前面的前缀变了。。。
这不是就是将我的设置变量直接给原样输出了吗。
在网上搜了下,各种雷同和眼花缭乱的设置,有的直接让我切换主题,我试了试都没成功,改用google搜了国外的一个帖子,跟之前原生终端设置类似,很快就搞定。
直接写在~/.zshrc
即可
cd ~
vi .zshrc
vi PS1="%n:%1~ $ "
source .zshrc
%n is the username of your account. %m is the MacBook’s model name. %1~ means the current working directory path where the ~ strips the $HOME directory location. %# means that the prompt will show # if the shell is running with root (administrator) privileges, or else offers % if it doesn’t.
OK了,跟以前显示一样了
PS:如果想继续保留切换zsh之前在~/.bash_profile保存的环境变量等信息,在.zshrc文件后面加入source ~/.bash_profile
就可以了。
- 分类:
- 操作
相关文章
ubuntu终端“确定”窗口无法点击
经常在ubuntu的终端里面看到如下的画面 但是我们无法点击“确定”,这时怎么办呢 我们用tab键可以切换到“确定”上面来,然后在回车就行了。快来试试吧。 阅读更多…