Use the SU command to switch to the root user;
Use
VI /ETC/BASHRC
command to insert the following code:
ps1="\e[1;32m\u\e[m\e[1;[ Email protected]\e[m\e[1;35m\h\e[m:\w\$"
After saving, enter the command under root user:
Source/etc/bashrc
can take effect.
Note: You can also enter ps1= "\e[1;32m\u\e[m\e[1;[in the/etc/profile Email protected]\e[m\e[1;35m\h\e[m:\w\$ ", but at this time the effect will only be automatically generated on the landing user, and use the SU command to switch to the root user, command prompt or normal color, you need to enter again at this time source/etc/ BASHRC to make the root user's command prompt change color. When the content is entered in/ETC/BASHRC, any user's command prompt color is changed.
If you want to modify different colors for each individual user's command prompt, you can use the Vim ~/.BASHRC command to modify each user's own BASHRC file in case each individual user logs in.
The modified effect:
CentOS 7 Operations Management Note (2)----Modify Command prompt color