如何在 linux shell 中隐藏 username@node?

tul*_*s85 4 linux shell solaris

我想隐藏username@solaris在 Unix shell 中。

我想要这样的东西:

$ ls -l
Run Code Online (Sandbox Code Playgroud)

相反,我有这个:

user@solaris:~$ ls -l
Run Code Online (Sandbox Code Playgroud)

Chr*_*ing 11

如果“类似”的意思是:'$' 普通用户,'#' 则 root 然后放入

PS1=\$
Run Code Online (Sandbox Code Playgroud)

在你的 .profile

否则使用

PS1=$
Run Code Online (Sandbox Code Playgroud)


cho*_*own 8

/etc/bashrc~/.bashrcPS1环境变量更改为PS1=$. 或者如果不PS1存在则添加一个新行:

PS1=$ 
Run Code Online (Sandbox Code Playgroud)

然后,运行这个:

source /etc/bashrc
Run Code Online (Sandbox Code Playgroud)

或者:

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