What is the command line prompt
As shown in the figure below, these series of features, namely the command line prompt
How to modify the command line prompt
For example, we know that in the default Linux Shell command line prompt, the directory displays not an absolute path, but a relative path. If we want to modify it, we can look like the following
# cat /etc/profile.d/motd.sh
export PS1='[\u@\H \w]\$ '
Of course this special variable PS1
can also be placed /etc/profile
inside
Which command line prompt symbols can be used in total
We can man bash
see
Commonly used special symbols are explained as follows
symbol | meaning |
---|---|
\ u | Current user name |
\H | CPU name |
\w | Absolute path of current directory |
\W | Relative path of current directory |
\$ |
User prompt, root #, non-root $ |
Reference
https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html