How To Set Environment Variable In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Use the export command to set environment variables at the command line. For example, to set the environment variable MYENVVAR to the value “myvalue”, type:
export MYENVVAR=”myvalue”
2. Edit the .bashrc or .profile file in the user’s home directory to permanently set environment variables. For example, to set the environment variable MYENVVAR to the value “myvalue”, add the following line to the .bashrc or .profile file:
export MYENVVAR=”myvalue”
3. Use the /etc/environment file to set system-wide environment variables. For example, to set the environment variable MYENVVAR to the value “myvalue”, add the following line to the /etc/environment file:
MYENVVAR=”myvalue”