修改ubuntu的终端提示符

修改/etc/profile文件为:

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ ' ,下面是添加的
    export PS1='[/u@/h /W/]/$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

然后,让其生效:

source /etc/profile
原文地址:https://www.cnblogs.com/youngkingwang/p/3030944.html