Presumably in the command-line mode for a long time, all look tired of that monotonous and ugly cue, the individual think also accounted for some bit, if the command long words will break.
Want to change into
CD ~/touch bash_profilevim. Bash_profile
OS X environment, key syntax \[ color \]prompt parameter \[$reset\] For example:\[ $red\]\ t\[$reset\]
reset=$ (tput sgr0) Green2) Yellow3) Blue4) Magenta 5 ) Cyan6) PS1="\[$magenta \]\u\[$reset \] at \[$blue \]\h\[$reset \] in \[$ yellow\]\w\n\[$reset \]\[$green \]\$\[$reset \]"export PS1
: Wq Save Away
source. bash_profile
How to use the Tput command
Prompt parameters:
- \a : An ASCII Bell character (07)
- \d : The date in ' Weekday Month date ' format (e.g., "Tue May 26")
- \d{format} : The format is passed to Strftime (3) and the result was inserted into the prompt string; An empty format results in a locale-specific time representation. The braces is required
- \e : An ASCII escape character (033)
- \h : The hostname up to the first '. '
- \h : the hostname
- \j : The number of jobs currently managed by the Shell
- \l : The basename of the shell ' s terminal device name
- \ n : NewLine (line wrapping)
- \ r : Carriage return
- \s : The name of the shell, the basename of $ (the portion following the final slash)
- \ t : The current time in 24-hour HH:MM:SS format
- \ t : The current time in 12-hour HH:MM:SS format
- \@ : The current time in 12-hour am/pm format
- \a : The current time in 24-hour hh:mm format
- \u : The username of the current user
- \v : The version of Bash (e.g., 2.00)
- \v : The release of bash, version + patch level (e.g., 2.00.0)
- \w : The current working directory, with $HOME abbreviated with a tilde
- \w : The basename of the current working directory, with $HOME abbreviated with a tilde
- \! : The history number of this command
- \# : The command number of this command
- \$ : If the effective UID is 0, a #, otherwise a $
- \nnn : The character corresponding to the octal number nnn
- \ \ : a backslash
- \[ : Begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
- \] : End a sequence of non-printing characters
Article reference, article reference 2
Customize Shell prompt