Linux modified terminal display prefix and environment variables

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.