October 6, 2014 — kyle.huynh205
Add Environment Variables permanently in CentOS Linux
To make it permanent for your user on the server, you would add it to /home/user/.bashrc
file. The .bashrc file is sourced when you login, so the parameters will become active when you login.
Add the following lines to your .bashrc file.
PATH={$PATH}:/{your_app_path}
Now when you login, you can simply type foo.sh at your liesure without worrying about setting the variable every time.
If you want to make this change global for all users, add an entry in /etc/profile.d. I wouldn’t recommend editing /etc/profile
itself.
echo "PATH=${PATH}:{your_app_path}" > /etc/profile.d/scripts-path.sh
Other environment variables