I tried to completely understand what symbols in PS1 statement of the terminal mean. I use Linux Mint 19.0 Cinnamon with default terminal "Gnome-terminal" and default theme. Command echo $PS1 displays the next contents:
Code: Select all
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$
The issue that I already understand:
\u - user name
\h - host name
\w - current working directory
\$ - if the effective UID ("user identifier") is 0 (i.e. root user), then pring #, otherwise print $
\e - an ASCII escape character (033)
\a - an ASCII bell character (07) (Bell character is the control code used to sound an audible bell or tone in order to alert the user. When it is sent to a printer or a terminal, nothing is printed, but an audible signal is emitted instead.)
\nnn - the character corresponding to the octal number nnn
(=> \033 corresponds to /e - an ASCII escape character)
\[ - 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
${ - start of the environment variable substition
} - end of the environment substition
Code ${debian_chroot:+($debian_chroot)} means
"if $debian_chroot is defined then use $debian_chroot else do nothing"
(usually $debian_chroot on user computer is not defined)
If I understand correctly,
\[\033[ means start color scheme
m\] means stop color scheme
0;32 - green color
01;32 - increase font weight and change color shade
0;34 - blue color
01;34 - increase font weight and change color shade
00 - white color
If it's all right then I've got the part of PS1-statement after $.
But what means symbols before it?
More specifically, what means "\[\e]0;"?
Why in this part we have duplicated "\u@\h: \w" and sound notification that is usually never heard?
I will be glad to any additional explanations of PS1-statement.