A character color
! # / bin / bash
# character color display
# - E: use the escape allow echo
# \ 033 [: Start bit # \ 033 [0m: End position # \ 033 is equivalent to the \ E echo -e " \ 033 [30m black word \ 033 [0m "# (white on black display was evident in style) echo -e " \ 033 [31M red word \ 033 [0m " echo -e " \ 033 [32M green word \ 033 [0m " echo -e " \ 033 [33m yellow word \ 033 [0m " echo -e " \ 033 [34m blue word \ 033 [0m " echo -e " \ 033 [35m purple word \ 033 [0m " echo -e " \ 033 [ 36m sky blue word \ 033 [0m " echo -e "\ 033 [37m white word \ 033 [0m "
Second, the background color
# Background color range: 40- 47
echo -e " \ 033 [40m on black \ 033 [0m " echo -e " \ 033 [41M red and white \ 033 [0m " echo -e " \ 033 [42m Green bottom white \ 033 [0m " echo -e " \ 033 [43m yellow with white \ 033 [0m " echo -e " \ 033 [44M blue and white \ 033 [0m " echo -e " \ 033 [45m white on purple \ 033 [0m " echo -e " \ 033 [46M sky blue and white \ 033 [0m " echo -e " \ 033 [47M white white \ 033 [0m "
Third, the character background color +
# Character color with the background color; Number separated (can be freely combined)
echo -e "\ 033 [40; 37m on black \ 033 [0m"
echo -e "\ 033 [41 is; 34m blue on red word \ 033 [ 0m "
echo -e" \ 033 [42 is; 34m blue characters on a green background \ 033 [0m "
echo -e" \ 033 [43 is; 34m blue on a yellow background \ 033 [0m "
echo -e" \ 033 [44 is; 30m blue black \ 033 [0m "
echo -e" \ 033 [45; 30m purple black bottom \ 033 [0m "
echo -e" \ 033 [46 is; 30m sky blue black \ 033 [0m "
echo -e "\ 033 [47; 34m white with blue letters \ 033 [0m"
Fourth, special effects
# 0: special effect
# 1: Highlight # 4: Underline # 5: Flashing # 7: Highlight # 8: hidden from
# with special effects and color; No. separated, order no echo -e " \ 033 [0; 46; 30m sky blue black \ 033 [0m " echo -e " \ 033 [. 1; 46 is; 30m sky blue black \ 033 [0m " echo -e " \ 033 [. 4; 46 is; 30m sky blue black \ 033 [0m " echo -e " \ 033 [. 5; 46 is; 30m sky blue black \ 033 [0m " echo -e " \ 033 [. 7; 46 is; 30m sky blue black \ 033 [0m " echo -e " \ 033 [. 8; 46 is; 30m sky blue black \ 033 [0m "
Fifth, the prompt color
[root@localhost ~]#vim /etc/bashrc
PS1="\e[1;36;40m[\u@\h \W]\\$\e[0m"
# source /etc/bashrc
Wherein PS1 common parameters are as follows:
\ d: # represents the date format weekday month date, for example: "Mon-Aug. 1"
\ H: # full host name
\ h: # take only the first host name
\ t: # display time format 24 hours such as: HH: MM: SS
\ T: # display for 12-hour format
\ a: # show time is 24 hour format: HH: MM
\ U: # current user account name
\ v: #BASH version information
\ w: # full name of the working directory
\ W: # use basename get working directory name, it lists only the last directory
\ #: # the first several commands issued
\ $: # prompt character, if a root, tips operators are: #, compared with the average user: $
Sixth, the prompt report -bash-4.2 #
The reason is that the root / root following several configuration files is missing, the missing file is as follows:
. 1, .bash_profile
2, .bashrc
these files are files for each user are necessary.
Use the following command from the master copy of the default configuration file back to the / root directory, cancellation relink back to normal
[root@localhost ~]#cp /etc/skel/.bashrc /root/
[root@localhost ~]#cp /etc/skel/.bash_profile /root/