Linux terminal prompt features are defined by the system environment variable ps1. Run the ''echo $ PS1 #39; #39; command to view the current settings. PS1 values are composed of a series of static text or
Linux terminal prompt features are defined by the system environment variable ps1. Run the ''echo $ PS1 #39; #39; command to view the current settings. The PS1 value is composed of a series of static text or \ and
Linux terminal prompt features are defined by the system environment variable ps1. Run ''echo $ ps1' to view the current settings.
The PS1 value is composed of a series of static texts or \ and escape character sequences, such:
PS1 = "\ u @ \ H \ w $"
Useful escape sequences include:
\ E ASCII Escape Character
\ H Host Name
\ H complete host name
\ L terminal device name
\ T in 24-hour format
\ T 12-hour time
\ U User Name
\ W current working directory (absolute path)
\ W current working directory (basename)
\! Location of the current command in the History buffer zone
\ $ If the current user is a super user, insert the character #; otherwise, insert the character $
\ [Appear before the Character Sequence without moving the cursor
\] Appears after non-printable characters
It is annoying to always face the black and white screen. We can set the PS1 variable to make the prompt a color. In PS1, set the Character Sequence color format:
\ [\ E [F; Bm \]
''F'' indicates the font color, ranging from 30 to 30 ~ 37; ''B 'indicates the background color, numbered 40 ~ 47.
You can use ''\ e [0m'' to disable color output. In particular, when B is set to 1, bold text is highlighted.
I think this is enough. It's time to customize it. Now post my settings:
If [$ TERM = 'linux ']; then
Export PS1 = "[\ [\ e [36; 1m \] \ u @ \ h \ [\ e [31; 1m \] \ w \ [\ e [32; 1 MB \]>"
Zhcon -- utf8
Clear
Elif [$ TERM = "xterm"]; then
Export PS1 = "[\ [\ e [31; 1m \] \ w \ e [0 m]>"
Fi
-------------------
-------------------
Meng Hu