Teach you how to make a Linux install, the color in the shell settings

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.