Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux environment variable settings methods and differences     - lack of SWAP space during installation of Oracle (Database)

- Hibernate Performance Optimization of reusing SessionFactory (Programming)

- Recovery from MySQL master data consistency summary (Database)

- QBit development of micro-services (Server)

- in no backup ex: error: Xin Tourou ah backup child process has Singles DAT / US person / bin / in no backup ex (Database)

- Linux vi command list (Linux)

- The Java way to stop a thread of execution (Programming)

- using Docker Kitematic on windows (Linux)

- Under CentOS Linux automatic backup MySQL database daily (Database)

- Tip: Use Cryptsetup U disk encryption (Linux)

- Oracle database with test data insertion speed (Database)

- C # and JavaScript arrays to re-summary (Programming)

- VMware virtual machine Ubuntu install arm-linux-gcc cross-compiler environment (Linux)

- CentOS 6.4 dial-up Raiders (Linux)

- How to install new fonts on Ubuntu 14.04 and 14.10 (Linux)

- HTTPS and SSH and use the difference between the way: Git User's Manual (Linux)

- CentOS 6.6 install rsync server (Server)

- Formatted output printf command (Programming)

- Traffic monitor Linux Python Version (Programming)

- QEMU image file used: qcow2 and raw (Linux)

 
         
  Linux environment variable settings methods and differences
     
  Add Date : 2017-08-31      
         
       
         
  Linux environment variable settings can export realization to be achieved by modifying a few files, it is necessary to clarify the difference between these two methods as well as several documents.

Linux environment variable settings through the file

The first is to set global environment variables, enter into force for all users:

etc / profile: This document set the environment information for each user's system. When a user logs in, the file is executed once, and collect shell settings from the configuration file /etc/profile.d directory. Usually used to set global variables for all users.
/ Etc / bashrc: When bash shell is opened, the file is read. That is, every time you open a new terminal shell, the file will be read.
Followed by the above-mentioned two documents and correspondence, but only takes effect on the individual user:

~ / .bash_profile Or ~ / .profile: take effect only for a single user, when the user logs in the file only once. Users can use this file to add shell variable information for their own use. Also in different LINUX operating system, this file may be different, it may be ~ / .bash_profile, ~ / .bash_login or ~ / .profile wherein one or more of the order if there are several, then executed It is: ~ / .bash_profile, ~ / .bash_login, ~ / .profile. For example, Ubuntu system is generally ~ / .profile file.
~ / .bashrc: Take effect only for a single user, login, and when every time you open a new shell, the file is read.
 

In addition, modify / etc / environment This file can also be achieved for setting environment variables. / Etc / environment is set up global variables from the file itself for action, / etc / environment is set up the entire system environment, and / etc / profile is set all the user's environment. There are several points to note:

The system first reads etc / profile and then read the / etc / environment (or vice versa?)
Information / etc / environment can not contain commands that directly VAR = "..." set, do not use export.
Use source / etc / environment variable settings can take effect immediately in the current window, the need to logout / restart after the order takes effect for each new terminal window.
Modify the Linux environment variable instances

In Ubuntu, for example, to modify the ~ / .profile file:

vim ~ / .profile
If the file exists, then the file was last seen the following code, the value of the PATH variable with a colon (:) separated:

# Set PATH so it includes user's private bin if it exists
if [-d "$ HOME / bin"]; then
PATH = "$ HOME / bin: $ PATH"
fi
Add the final Code PATH = "$ PATH: / usr / local / Hadoop / bin", pay attention to the equal sign (=) with no spaces on either side, namely:

# Set PATH so it includes user's private bin if it exists
if [-d "$ HOME / bin"]; then
PATH = "$ HOME / bin: $ PATH"
fi
PATH = "$ PATH: / usr / local / hadoop / bin"
Because the file is in the user login is only read once, so you need to restart to take effect (modify / etc / profile, / etc / environment is also true). But you can use the command source ./.profile to take effect immediately. You can see the value of the variable modified by the echo $ PATH:

source ./.profile
echo $ PATH
Modify the Linux environment variables Shell commands export

Another way to modify the Linux environment variable is through the Shell command export, do not pay attention to the variable name has a dollar sign $ assignment statement only needs to have:

export PATH = $ PATH: / usr / local / hadoop / bin
export mode only for the current terminal Shell effective: using variable export settings, valid only for the current terminal Shell, which means that if you open a new terminal, then this variable is set in the new export terminal manipulation can not be read to. Suitable set up some temporary variables.

According to the desired variable, select Settings mode, for example JAVA_HOME variable such, it is suitable to set a global variable can be set in / etc / environment in.
     
         
       
         
  More:      
 
- How do I delete a NEEDS RECOVERY rollback state of undo tablespace (Database)
- LVM mirrored logical volume to achieve (Linux)
- CentOS7 boot systemd introduction and use of management (Linux)
- MySQL related statements (CRUD) (SQLyog software) (Database)
- Linux more command Detailed (Linux)
- Additional SQL Server 5123 database reported error (Database)
- Linux loopback adapter Driven Design (Programming)
- ImportTsv-HBase data import tool (Database)
- Fedora 22 installation and configuration optimization (Linux)
- Ubuntu 14.04 can be used to create a WIFI hotspot for Android (Linux)
- Security basics: simple analytical framework for Linux system firewall (Linux)
- Oracle Data Guard LOG_ARCHIVE_DEST_n optional attribute parameters (Database)
- Shell Programming points to note about the function (Programming)
- Asynchronous JavaScript loading (Programming)
- In-depth summary of the PHP core of object-oriented (Programming)
- CentOS install expect (Linux)
- SecureCRT session buffer size settings (Linux)
- Explore Android SQLite3 multithreading (Programming)
- RHEL5 / 6 Installation Notes (Linux)
- PL / SQL data types (Database)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.