Into the Linux system command line prompt landscaping (PS variable modification)

Command prompt PS1 (capital plus the number 1 ps) variable contents:
PS1 = "[\ and @ \ h \ W] $ '(Default format)
\ d: The date format may display a "day of week", such as: "Mon Feb 2"
\ H: full hostname.
\ h: Take only the host name names before the first decimal point
\ t: display time in 24 hour format "HH: MM: SS"
\ T: show time as "HH 12-hour format: MM: SS "
\ a: display time as" HH 24-hour format: MM "
@: display time for the 12-hour format," am / pm "style
\ u: current user's account name, such as" root ";
\ v : BASH version information
\ w: complete working directory name, written by the root from the directory name. But home directory will be replaced by ~;
\ W: use basename function to obtain the working directory name, it lists only the last directory name.
#: The first few commands issued.
$: Prompt character, if a root, prompt characters #, otherwise $
Color Settings:
In the character color setting PS1 format as: [\ e [F; Bm ] ... [\ e [0m], where "F" is a font color, No. 30-37, "B" is the background color, numbered 40 -47, [\ e [0m] is set as the end color.
  Color Chart:
    the FB
    30 40 Black
    31 41 Red
    32 42 Green
    3343 Yellow
    3444 Blue
    3545 purple
    3646 cyan
    3747 white
such as:
PS1 = '[[\ E [32; 40m] \ U @ \ h \ w \ t] $ [\ e [0m] '
by export PS1 =' [\ u @ \ h \ W] $ ' settings to take effect, restart failure,

Permanent modifications required vim ~/.bashrcFile Added:
PS1="[\e[37;40m][[\e[32;40m]\u[\e[37;40m]@\h [\e[36;40m]\w[\e[0m]]\$ " (Can be copied directly use.)
Results: [root@localhost /media/samba]#Show full working directory, pretty much.
Published 31 original articles · won praise 8 · views 9602

Guess you like

Origin blog.csdn.net/kim5659/article/details/104514814
Recommended