We can easily view already stored Environment Variables using Terminal.
- Display Currently defined variable list.
printenv
- Display Currently defined variable list.
echo $PATH (display the program search path)
- using env
- Set Environment variables.
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
- Erasing Environment Variables.
export PATH=Using above commands you can handle environment variables temporally. If you want to handle Environment Variables Permanently you want to know how they are stored in your architecture.
Environment Variables are stored in two difference ways called Session Specific and System Specific.
1. Session Specific Variables.
These are mostly stored in the specific hidden files/scripts in your home directory. Specially we can identify 3 ways to store Environment Variables.
- ~/.profile
- ~/.bash_profile or ~/.bash_login
- ~/.bashrc
- ~/.bash_logout
These Variables are using whole System and affected all users/sessions in runing time.
- /etc/profile
- /etc/bash.bashrc
- /etc/environment
No comments:
Post a Comment