Linux environment variable PS1 settings

Source: Internet
Author: User
Linux environment variables PS1 set linux environment variables PS1 is simply set command prompt display content, as follows: www.2cto.com1root@10.1.1.200 :~ # The meaning of the prompt in the PS1 variable: \ d: indicates the date. The format is weekdaymonthdate, for example, Wed... linux environment variables PS1 set linux environment variables PS1 in simple words is to set the command prompt to display the content, as follows: www.2cto.com 1root@10.1.1.200 :~ # The meaning of the prompt in the PS1 variable: \ d: represents the date in the format of weekday month date, for example, Wed Dec 12 \ H: complete host name. For example, the hostname is debian. linux \ h: only the first name of the host. for example, debian ,. 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: The account name of the current user, for example, root \ v: BASH version information, for example, 3.2 \ w: The Complete working directory name. In the home directory ~ In place of/etc/default/\ W: use basename to get the working directory name. Therefore, only the last Directory is listed. in the preceding example, only default \ # is displayed \#: the following command is issued: www.2cto.com \ $: the prompt character. if it is root, the prompt is: #, and the normal user is: $, but the command prompt is found to be in a color, you can set the PS1 variable to make the prompt color. in PS1, set the character sequence color format to \ [\ e [F; Bm \], where "F" is the font color, 30-30 ~ 37; "B" indicates the background color, numbered 40 ~ 47. Unset: \ [\ e [0m \] www.2cto.com code corresponding to each font color: reset = 0, black = 30, red = 31, Green = 32, yellow = 33, blue = 34, Magenta = 35. cyan = 36, white = 37
\ E [1; 31 m set to red, \ e [0 M color reset. You only need to replace 31 with the desired color code to print the code corresponding to the color background: reset = 0, black = 40, red = 41, green = 42, yellow = 43, blue = 44, Magenta = 45. blue = 46, white = 47 B code meaning 0 OFF1 highlighted (commonly used) 4 underline 7 reverse white display 8 invisible below is the PS1 variable prompt into color www.2cto.com 1root@10.1.1.200: opt # PS1 = '$ {debian_chroot: + ($ debian_chroot)} \ [\ e [01; 32m \] \ u \ [\ e [00m \] @ \ [\ e [01; 31m \] $ ip \ [\ e [00m \]: \ [\ e [01; 34m \] \ W \ [\ e [00m \] \ $ '2root @ 10.1.1.200: opt # Remember to write in. in the bashrc file.
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.