I. Introduction of PS1
PS1 the environment variable used to set the command prompt.
The default PS1 content is:[\[email protected]\h \w]\$
The default prompt is:[[email protected] ~]#
[username @ hostname Path]# (#表示root, $ = Normal user)
Second, set PS1
Open:vim ~/.BASHRC
Added:ps1= ' [\e[31m\]\[email protected]\[\e[36m\]\h \w]\$\[\e[m\] '
Execution:source ~/.BASHRC
\d: Represents the date, formatted as weekday month date, for example: "Mon-1"
\h: The full host name. For example: My machine name is: Fc4.linux, then this name is Fc4.linux
\h: Only the first name of the host is taken, as in the example above, then Fc4,.linux is omitted
\ t: Display time in 24-hour format such as: HH:MM:SS
\ t: Display time in 12-hour format
\a: Display time in 24-hour format: hh:mm
\u: Current user's account name
Version information for \v:bash
\w: The full working directory name. Home directory will be replaced by ~
\w: Use basename to get the working directory name, so only the last directory is listed
\#: The first few commands issued
\$: Prompt character, if root, Prompt is: #, normal user is: $
Environment variable: PS1