RHEL / CentOS shell 显示帐号及主机名


RHEL 及 CentOS 登入到 shell 后, 指令提示符前面会出现:

-bash-4.2$

-bash-4.1$

要将 shell 指令提示符前面, 改成显示帐号名称及主机名, 可以这样做:

1. 在 CLI 输入以下指令, 开启档案 .bash_profile:

$ vi ~/.bash_profile

加入以下内容:

储存盘案后离开编辑器,下次登入便会自动显示帐号名称及主机名。如果想立即生效, 可以执行以下指令:

$ source ~/.bash_profile

这样, CLI 就会显示 username@hostname 的格式。

Leave a Reply