8

Mac切换终端至Oh My Zsh后,保留原/bin/bash终端显示名

 2 years ago
source link: https://www.daozhao.com/10546.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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

file

Oh my zsh

现在很多人用的 这个了,Mac的默认终端也改成/bash/zsh

今天第一次使用Oh my zsh,然后发现终端前面的前缀变了。。。 file 这不是就是将我的设置变量直接给原样输出了吗。

在网上搜了下,各种雷同和眼花缭乱的设置,有的直接让我切换主题,我试了试都没成功,改用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了,跟以前显示一样了

file

PS:如果想继续保留切换zsh之前在~/.bash_profile保存的环境变量等信息,在.zshrc文件后面加入source ~/.bash_profile就可以了。

更新时间:2022-06-01 18:01

ubuntu终端“确定”窗口无法点击

经常在ubuntu的终端里面看到如下的画面 但是我们无法点击“确定”,这时怎么办呢

我们用tab键可以切换到“确定”上面来,然后在回车就行了。快来试试吧。 阅读更多…


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK