在当前终端中使用:
export PS1='[\u@\h \w]$'
如果需要持续使用,代码如下:
sudo -i # 切换为root用户 echo "export PS1='[\u@\h \w]$'" >> /etc/profile