How to change the Ubuntu terminal user name color to red
Linux: Ubuntu 14.04
If you enter a specific symbol, Garbled text will be displayed in the Garbled text !!!!!!!!
Picture of the entire operation code process and final display result
Input> echo $ PS1
Display: as shown in Figure
Enter in the personal user folder
Enter gedit ~ /. Bashrc
Modify these lines of code
If ["$ color_prompt" = yes]; then
PS1 = ....
Else
PS1 =...
Fi
Unset color_prompt force_color_prompt
# If this is an xterm set the title to user @ host: dir
Reset:
# If ["$ color_prompt" = yes]; then
# PS1 = '$ .......... \ [\ 033 [01; 32m \] \ u @ \ h \ [\ 033 [00m \]: \ [\ 033 [01; 34m \] \ w \ [\ 033 [00m \] \ $'
# Else
# PS1 = '$... \ u @ \ h: \ w \ $'
# Fi
Unset color_prompt force_color_prompt
# If this is an xterm set the title to user @ host: dir
Add the following line at the end of the file:
(The next line is) PS1 = '$ ................... \ 033 [01; 31m \] \ u \ [\ 033 [00m \] @ \ h: \ w \ $'
Save and exit. Then, click "source", that is, enter> source ~ /. Bashrc
The path/root in the root folder is also operated.
These are my personal changes.
The following is an online reference: (next)
Customer: PS1 = '$ ........................ \ [\ 033 [01; 32m \] \ u @ \ h \ [\ 033 [00m \]: \ [\ 033 [01; 34m \] \ w \ [\ 033 [00m \] \ $'
Root: PS1 = '$ ........................ \ [\ 033 [01; 32m \] \ u @ \ h \ [\ 033 [00m \]: \ [\ 033 [01; 34m \] \ w \ [\ 033 [00m \] \ $'