The order in which environment variables are loaded after Linux startup is: ETC/PROFILE→/ETC/PROFILE.D/*.SH→~/.BASH_PROFILE→~/.BASHRC→[/ETC/BASHRC]
To change the color of the shell font after a user logs in, add PS1 content to the ~/.BASHRC, and the following is my machine's settings:
#. bashrc# User specific aliases and FunctionsaliasRM='rm-i'aliasCP='cp-i'aliasMV='mv-i'aliasVI='Vim'# Source Global Definitionsif[-F/ETC/BASHRC]; Then . /etc/BASHRCfiPS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h\[\e[35;40m\]\w\[\e[0m\]]\\$"Export Prompt_command='{msg=$ (History 1 | {read x y; echo $y;}); user=$ (WhoAmI); echo $ (date "+%y-%m-%D%h:%m:%s"): $user: ' pwd '/: $msg----$ (who am I); } >>/tmp/' hostname '. ' WhoAmI '. History-timestamp '~
Actual effect:
The common parameters of PS1 are as follows:
Date, for example:"Mon 1"\h: #完整的主机名称 \h: #仅取主机的第一个名字 \ t: #显示时间为24小时格式, such as: hh:mm:ss\t : #显示时间为12小时格式 \a: #显示时间为24小时格式: hh:mm\u: #当前用户的账号名称 \v: #BASH的版本信息 \w : #完整的工作目录名称 \w: # Use basename to get the working directory name, so only the last directory is listed \#: #下达的第几个命令 \$: #提示字符, if it is root, the prompt is: #, the normal user is: $
Color value setting: The format of the character color in PS1 is: \[\e[f; Bm\], where "F" is the font color, number is 30-37, "B" is the background color, number 40-47. The color table is as follows
F B - +Black to ARed + theGreen - +Yellow the -Blue * $Purplish Red $ $Cyan BluePanax Notoginseng -White
Teach you how to make a Linux install, the color in the shell settings