LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-08-2013, 12:31 PM   #1
cristi92b
Member
 
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:
Code:
# 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
lleb
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
netnix99
Member
 
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
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,254

Rep: Reputation: 314Reputation: 314Reputation: 314Reputation: 314
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
cristi92b
Member
 
Registered: May 2011
Posts: 89

Original Poster
Rep: Reputation: Disabled
Thank you!
 
  


Reply


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


All times are GMT -5. The time now is 01:58 AM.

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