Color settings under PS1 terminal under Linux

Source: Internet
Author: User

In Linux the end of the input command, because all are black white paper, always do not know that line is the command of their own input, which is the result of the command.

In the Internet search, the original to modify the/ETC/BASHRC global configuration file or the ~/.BASHRC file.

1.ps1

to modify the Linux terminal command line color, we need to use the PS1,PS1 is an environment variable for Linux end users to describe the command line prompt settings. In the terminal input command: #set, you can find the definition of PS1 in the output as follows: PS1= ' [\[email protected]\h \w]\$ ' PS1 the definition of a commonly used parameter is as follows: \d: #代表日期, formatted as weekday Month date, for example:"Mon 1"   \h: #完整的主机名称   \h: #仅取主机的第一个名字  \ t: #显示时间为24小时格式, such as: HH:MM:SS   \ t: #显 Display time is 12 hours format   \a: #显示时间为24小时格式: hh:mm   \u: #当前用户的账号名称   \v: #BASH的版本信息   \w: #完整的工作目录名称   \w: #利用base Name gets the working directory names, so only the last directory is listed   \#: #下达的第几个命令   \$: #提示字符, if it is root, the prompt is: #, the average user is  : $

2. Color settings

(Source: http://www.cnblogs.com/Robotke1/archive/2013/05/10/3071634.html)

3. My personal ps1:export ps1= "\[\e[31;47m\]\[email protected]\h \ t \[\e[34;47m\]\w \$ \[\e[;m\]"

Note: [\e[31;47m\]\u set the user name (i.e. eblly) of the character and background colors.

Article: http://www.cnblogs.com/Robotke1/archive/2013/05/10/3071634.html

Http://www.cnblogs.com/welen/articles/3493354.html

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.