如何删除终端提示中的主机名部分?

Nav*_*mar 1 prompt ubuntu terminal

我的终端提示看起来像这样

naveen@webitmarket:~$
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

我想删除@webitmarket.

我怎样才能做到这一点?

Zan*_*nna 6

打开终端ctrl+ alt+t和类型

nano .bashrc
Run Code Online (Sandbox Code Playgroud)

ctrl+w并输入

PS1=
Run Code Online (Sandbox Code Playgroud)

然后enter- 这应该带你到你需要编辑的行,但检查如下:

找到你的这个部分 ~/.bashrc

if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Run Code Online (Sandbox Code Playgroud)

编辑第二行,让它说这个(删除@\h

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
Run Code Online (Sandbox Code Playgroud)

保存ctrl+ othenenter并退出ctrl+ o,然后在终端输入

source ~/.bashrc
Run Code Online (Sandbox Code Playgroud)