A long list is displayed by default in front of the Linux terminal, such as:
[Email protected] dir]$
This is determined by the PS1 environment variable:
[Email protected] dir]$ echo $PS 1
[\[email protected]\h \w]\$
Where \u represents the user, \h represents the host, \w represents the directory
There are three ways to modify environment variables:
1. Direct modification, only works for the current shell
[[email protected] dir] $PS 1= ' [\[email protected] \w]\$ '
[[email protected] dir] $PS 1= ' [\[email protected]\h \w]\$ '
[Email protected] dir]$
or modify the environment variable with the Export command:
[[email protected] dir] $export ps1= ' [\[email protected] \w]\$ '
[[email protected] dir] $export ps1= ' [\[email protected]\h \w]\$ '
[Email protected] dir]$
2. Modify the BASHRC file in the user's home directory
At the bottom of the ~/.BASHRC file, add:
Export ps1= ' [\[email protected] \w]\$ '
Then go back to the shell and run bash to see the effect, and every login will take effect.
[Email protected] dir]$ bash
[Email protected] ~]$
3. Modify/etc/profile, but this generally requires root privileges.
Linux modified terminal display prefix and environment variables