environment variable PS1 setup under Linux

Source: Internet
Author: User

The meaning of the prompt in the PS1 variable:

\d: Represents the date, in the format weekday month date, for example: Wed Dec 12\h: Full host name. For example: hostname is debian.linux\h: Take the first name of the host only, as in the example above, then the debian,.linux is omitted \ t: Display time in 24-hour format, such as: hh:mm:ss\t: Display time 12 hours format \a : Display time is 24 hours format: hh:mm\u: The current user's account name such as: Root\v:bash version information such as: 3.2\w: The full working directory name. The home directory will be replaced with a ~ such as display/etc/default/\w: Using basename to get the working directory name, so only the last directory is listed as shown in the previous example, only the default\#: the first command issued www.2cto.com \$: prompt character, If it is root, the prompt is: #, the normal user is: $ but the discovery command prompt is a color, here you can set the PS1 variable to make the prompt into color, in the PS1 set the character sequence color format: \[\e[f; Bm\] where "F" is the font color, number 30~37; "B" is the background color, number 40~47. Cancellation settings: \[\e[0m\] www.2cto.com the code for each font color: reset = 0, black = 30, red = 31, green = 32, yellow = 33, blue = 34, magenta =35. Cyan = 36, white =37
\e[1;31m set to red, \e[0m color reset. Just replace 31 with the desired color code to get my settings

Ps1= ' ${debian_chroot:+ ($debian _chroot)}\[\033[01;32m\]\[email protected]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[ 00m\]\$ '

environment variable PS1 setup under Linux

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.