Drop one first:
How to make your LD terminal more personal? First of all, we need to understand the following points of knowledge.
A: Configuration file
Personal configuration file:~/.BASHRC
Global settings file:/ETC/BASH.BASHRC (Modify requires Administrator privileges)
B
The command prompt is controlled by a special shell variable, namely: PS1,PS2,PS3,PS4.
We can only consider PS1. Execute at Terminal
What does the \n,\t,[in the output above mean? Here are some escape characters, which represent:
\a: Display time in 24-hour format (hh:mm)
\d: Represents a date in the format "Day of the Week"
\h: Displays the full host name
\h: Take the first name of the host only
\ n: Create a new row
\ t: Display time in 24-hour format, e.g., HH:MM:SS
\ t: Display time in 12-hour format
\u: Displays the account name of the current user
\v: Displays version information for BASH, such as 2.00
\v: Displays the version of Bash, including patch information, such as 2.00.0
\w: Displays the current working directory, unlike \w, which has a wavy number in front of the directory
\w: The full working directory name. The home folder is replaced by ~
\#: The first few commands issued
\$: Prompt character, general user is $, Administrator rights Display #
\[: non-printable character reference begins
\]: End of non-printable character reference
\ \: Back slash
How would you like to test your changes without modifying the original configuration file? We can enter the ps1= ' custom ' in the terminal, the return, can display the effect.
Here are some simple examples:
My own PS1.
Ps1= ' [\[\e[36;1m\]\[email protected]\h\[\e[31;1m\]\w\[\e[32;1m\]] ~\t\n> '
Default
12 |
PS1="\w:"#简单输出当前目录 PS1="\$:"#这个更简单 |
D
So how do you make it "color"?
The general set color format is:' \e[x;ym $PS 1 \e[m '
Explain:
\e[: Start color scheme settings
X;y: Color Pairing
\e[m End color scheme settings
Example: ps1= "\[\e[1;31m\] linuxdeepin"
More colors, such as:
How to modify or beautify a Linux terminal