Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-08-2013, 12:31 PM   #1
Registered: May 2011
Posts: 89

Rep: Reputation: Disabled
Environment Variables

How can I change environment variables in linux? for example, if I want to add some path to the PATH variable:
# export PATH=$PATH:/usr/something
But how can I make this permanent, for a single user, and for all users?
Old 10-08-2013, 12:42 PM   #2
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
edit your ~/.bash_rc or the equivalent file for your distro.

then log out and back in and the new path should take effect.
1 members found this post helpful.
Old 10-08-2013, 01:05 PM   #3
Registered: Jun 2011
Distribution: redhat, CentOS, OpenBSD
Posts: 298

Rep: Reputation: 98
lleb has it for the individual....If you want to make it apply to everyone, add it to /etc/profile
1 members found this post helpful.
Old 10-08-2013, 01:10 PM   #4
Senior Member
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,254

Rep: Reputation: 315Reputation: 315Reputation: 315Reputation: 315
You can edit /etc/bash.bashrc and ~/.bashrc for shell scripts and /etc/profile, /etc/profile.d or ~/.profile for login shells, there is also system wide settings in /etc/environment. Files in /etc are global and in user home directory are specific to this user. This is if somebody uses Bash shell, for other shells may be other files.
Old 10-09-2013, 07:49 PM   #5
Registered: May 2011
Posts: 89

Original Poster
Rep: Reputation: Disabled
Thank you!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Environment Variables rblampain Programming 1 12-04-2011 11:40 AM
environment variables siva balan Linux - Newbie 2 10-16-2010 04:04 AM
environment variables Prakhardeep Linux - Software 3 10-06-2004 04:30 AM
when to use environment variables? mark_2811 Programming 2 02-23-2004 07:09 PM
environment variables aethereal Linux - Newbie 7 12-19-2001 10:34 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration