Linux environment variables view and Settings __linux

Source: Internet
Author: User

1. Set the environment variable directive:

Export

For example: Export m2_home= "/opt/maven" This instruction set the M2_home point to a path

Echo View

echo $M 2_home If m2_home is defined, its value is displayed

Modify

Modify the environment variable for path path and append a path

Export path= $PATH:/home/kvmimg This is to append a string directly as a supplemental path, which is equivalent to stitching directly on the original path ":/home/kvmimg"

It can also be spliced by environment variables:

Export path= $PATH: $M 2_home


2. Effective Range

The same as Windows CMD window, in the CMD window to perform any environment variable settings, close the window after the new window, it is invalid, if set to the system to set environment variables

Linux is the same, there are several places in Linux can set environment variables

1,/etc/profile: At logon, the operating system to customize the user environment to use the first file, this file for each user of the system to set the environment information, when the user first logon, the file was executed.
2./etc/environment: The second file that the operating system uses at login, the system sets the environment variable of environment file before reading your own profile.
3, ~/.BASHRC: This file contains bash information dedicated to your bash shell, which is read when you log in and each time you open a new shell. ~ Represents the user directory, such as:/root or/home/lawmansoft

4./etc/rc.local: Scripts that are executed automatically


3. View all Environment variables

Env can also append grep to filter, for example: Env |grep java_home will show: java_home=usr/lib/jvm/jdk1.7.0_01


Setting up the system for English environment

Export Lang=uc_en

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.