Linux host name color settings, ps1 settings, but linux color

Source: Internet
Author: User
Linux host name color settings, ps1 settings, but linux has a color RedHat font and background color change method: Command: PS1 & quot; [\ e [32; 1 M \ u @ \ h \ W] \\$ & quot; or exportPS1 & quot; [\ e [32; 1 M \ u @ \ h \ W] \\\ & quot; for details about the differences between the two, see the description of environment variables: \ e [32; 1... linux host name color settings, ps1 settings, but linux has a color RedHat font and background color change method: Command: PS1 = "[\ e [32; 1 M \ u @ \ h \ W] \ $ "or export PS1 =" [\ e [32; 1 m \ u @ \ h \ W] \ $ "for the differences between the two, please refer to the environment variable related information explanation: \ e [32; 1 m: this is the escape character that controls the font and background color, 30 ~ 37 is the font color, 40 ~ 47 is the 32 in the background color example. the position of the 1 m digit can be reversed, for example, \ e [1; 32 m. if it is in the X environment, you can change the range of 1 to 0 ~ 10, some useless places: 0 or do not write (\ e [0; 32 m or \ e [; 32 m) show light color, 1: show highlighted 4: underline ..... if the effect is not good but cannot be restored, do not write the number before m, such as \ e [32; m, or log out directly and log on to \ u \ h \ W: this is an escape character. \ d: represents a date in the format of weekday month date. for example, "Mon Aug 1" \ H: complete host name. For example, if my machine name is fc4.linux, this name is fc4.linux \ h: only the first name of the host. in the preceding example, it is fc4 ,. linux is omitted \ t: The display time is in the 24-hour format, for example, HH: MM: SS \ T: the display time is in the 12-hour format \ A: The display time is in the 24-hour format: HH: MM \ u: account name of the current user \ v: BASH version \ w: complete working directory name. In the home directory ~ Replace \ W: use basename to get the name of the working directory. Therefore, only the last directory \ # is listed. for example, if it is root, the prompt is: #. for normal users, the value $ \ n indicates that the font of a new row is not limited to one color. it can have multiple colors: PS1 = "[\ e [32; 1 Mbit/s \ u @ \ e [35; 1 Mbit/s \ h \ e [31; 1 Mbit/s \ W] \ $ "the above two commands will become invalid after logging out, use the following method to make it permanently effective: vi/etc/profile is in the "export PATH ..... "Add a line below: export PS1 =" [\ e [32; 1m \ u @ \ h \ W] \ $ "log out and log on again. if the line does not take effect, use the source/etc/profile command or restart the machine.

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.