Modify hostname color

Add in the last line of the /etc/profile file

PS1='\[\e[1;36m\][\[\e[31;1m\]\u\[\e[33;1m\]@\[\e[32;1m\]\h\[\e[36;1m\]\w] \[\e[31;1m\]# \[\e[0m\]'
[root@master01/opt] # cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "${PS1-}" ]; then
  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\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

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

PS1='\[\e[1;36m\][\[\e[31;1m\]\u\[\e[33;1m\]@\[\e[32;1m\]\h\[\e[36;1m\]\w] \[\e[31;1m\]# \[\e[0m\]'

Guess you like

Origin blog.csdn.net/qq_48480384/article/details/127435235