CentOS command prompt color and style Comments

Command Prompt: prompt

View the current command prompt format under CentOS:

1 [root @ localhost ~] # echo $ PS1 PS1 # display style of the current use of
 2 [\ U @ \ H \ W] \ $

    Command prompt parameters are as follows:

\ d: # represents the date format weekday month date, for example: "Mon-Aug. 1" 
\ H: # full host name 
\ h: # take only the first host name 
\ t: # display time format 24 hours such as: HH: MM: SS 
\ T: # display for 12-hour format 
\ a: # show time is 24 hour format: HH: MM 
\ U: # current user account name 
\ v: #BASH version information 
\ w: # full name of the working directory 
\ W: # use basename get working directory name, it lists only the last directory 
\ #: # the first several commands issued 
\ $: # prompt character, if a root, tips operators are: #, compared with the average user: $

  Modify the command prompt is as follows:

  

PS1="[\[\e[1;5;41;33m\]\u@\h \t\w]\$\e[0m\]"

The effect is as:

Represents 5 wherein highlighting for flash red 41 represents the bottom

Color parameters are as follows:

The FB
 30   40   black
 31 is   41 is   red
 32   42 is   green
 33 is   43 is   yellow
 34 is   44 is   blue
 35   45   purple
 36   46 is   cyan
 37 [   47   White

How to restart to take effect in /etc/profile.d/ add startup script. Command is as follows:

VI /etc/profile.d/ the env . SH 
add the following command:
PS1 = " [\ [\ E [. 1; 41 is; 33m \] \ U @ \ H \ T \ W] \ $ \ E [0m \] "
save and exit.

You can reload at:

source /etc/profile.d/env.sh

 

Guess you like

Origin www.cnblogs.com/chixinshuaishuai/p/11123304.html