View and add environment variables under Linux

Source: Internet
Author: User

&path: Determines to which directories the shell will look for commands or programs, the PATH value is a series of directories, when you want to run a program, Linux in these directories to search and compile links.

Edit the path declaration in the following format:

 Path= $PATH: <path1>:<path2>:<path3>:------:<pathn>

  You can add the specified path yourself, separated by a colon. When the environment variable is changed, it takes effect the next time the user logs on, and if you want to take effect immediately, you can execute the following statement: $source. bash_profile

Export command: View the value of path

Use: [&&&@******/]$ Export

View PATH environment variables separately, available: echo $PATH

The first type: Temporarily add environment variables :

Add Command: Export path= path: $PATH

View command: Echo $PATH to determine if the PATH was added successfully.

The path to the method described above disappears after the terminal is closed. So it is recommended to edit the /etc/profile to change the path, you can also change the home directory of the. BASHRC (i.e.: ~/.BASHRC).

The second way: it's permanent.# Vim/etc/profile at the end of the document, add:export path= "directory: $PATH" ( Note: There can be no spaces between PATH and equal sign, equal sign, and later )Save, exit, and then run:#Source/etc/profile no error is successful.

View and add environment variables under Linux

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.