Environment variables in Ubuntu

24. May 2009

The following is a exstract from Ubuntu help

The can be used to set enviroment variables in the terminal: ~/.bashrc

Session-wide environment variables

In order to set environment variables in a way that effects a user's entire desktop session, one may place commands to set their values in one of the "hidden" script files in the user's home directory. The more common such files are outlined below.

  • ~/.profile - This is probably the best file for placing environment variable assignments in, since it gets executed automatically by the DisplayManager during the startup process desktop session as well as by the login shell when one logs-in from the textual console.

  • ~/.bash_profile or ~./bash_login - If one of these file exist, bash executes it rather then "~/.profile" when it is started as a login shell. (Bash will prefer "~/.bash_profile" to "~/.bash_login"). However, these files won't influence a graphical session by default.

  • ~/.bashrc - Because of the way Ubuntu currently sets up the various script files by default, this may be the easiest place to set variables in. The default configuration nearly guarantees that this file will be executed in each and every invocation of bash as well as while logging in to the graphical environment. However, performance-wise this may not be the best thing to do since it will cause values to be unnecessarily set many times.

 

System-wide environment variables

Environment variable settings that effect the system as a whole (rather then just a particular user's desktop session) can be placed in any of the many system-level scripts that get executed when the system or the desktop session are loaded. Ubuntu defines several locations dedicated to placing such settings:

  • /etc/profile - This file gets executed whenever a bash login shell is entered (e.g. when logging in from the console or over ssh), as well well as by the DisplayManager when the desktop session loads. This is probably the file you will get referred to when asking veteran UNIX system administrators about environment variables. In Ubuntu, however this file does little more then invoke the /etc/bash.bashrc file.

  • /etc/bash.bashrc - This is is the system-wide version of the ~/.bashrc file. Ubuntu is configured by default to execute this file whenever a user enters a shell or the desktop environment.

  • /etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.

Ubuntu

Comments

6/25/2009 5:40:24 PM #
thanks for these files, I'll use them.
7/22/2009 8:57:30 AM #
Tried to autotranslate you site not understand the writing any hope deutsch version?
8/14/2009 8:36:52 AM #
Would you like to post a guest post on my blog?
8/16/2009 6:17:58 AM #
Please let me know if you are interested to work as article writer for me? I can offer $10/article.
8/18/2009 4:37:53 AM #
Do you accept guest posts? I would love to write couple articles here.
8/26/2009 6:14:04 PM #
Tried to autotranslate you site not understand the writing any hope deutsch version?
8/28/2009 1:58:57 PM #
Hello. Great job. I did not expect this on a Wednesday. This is a great story. Thanks!
8/28/2009 1:59:00 PM #
Nice post! GA is also my biggest earning. However, it�s not a much.Smile
11/10/2009 10:21:17 PM #
Valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!! Thumbs up
11/12/2009 5:54:35 AM #
Hrmm that was weird, my comment got eaten. Anyway I wanted to say that it's nice to know that someone else also mentioned this as I had trouble finding the same info elsewhere. This was the first place that told me the answer. Thanks.
11/14/2009 1:16:23 AM #
I have recently started using the blogengine.net and I having some problems here? in your blog you stated that we need to enable write permissions on the App_Data folder...unfortunately I don't understand how to enable it.
11/14/2009 11:54:19 PM #
Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful.
11/16/2009 12:30:39 AM #
I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.
11/16/2009 11:37:58 PM #
Well, this is my first visit to your blog! We are a group of volunteers and starting a new initiative in a community in the same niche. Your blog provided us valuable information to work on. You have done a marvellous job!
11/18/2009 1:54:12 AM #
Admiring the time and effort you put into your blog and detailed information you offer! I will bookmark your blog and have my children check up here often. Thumbs up!
11/19/2009 12:24:48 AM #
Hrmm that was weird, my comment got eaten. Anyway I wanted to say that it's nice to know that someone else also mentioned this as I had trouble finding the same info elsewhere. This was the first place that told me the answer. Thanks.
11/20/2009 12:03:31 PM #
Howdy, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam comments? If so how do you prevent it, any plugin or anything you can advise? I get so much lately it's driving me mad so any assistance is very much appreciated.
11/20/2009 1:10:06 PM #
helpful information indeed. thanx for your sharing with all of us. continue your great job, and always gain my support!~~
11/21/2009 4:14:04 AM #
Keep 'em coming... you all do such a great job at such Concepts... can't tell you how much I, for one appreciate all you do!
11/22/2009 5:39:16 AM #
Nice information, many thanks to the author. It is incomprehensible to me now, but in general, the usefulness and significance is overwhelming. Thanks again and good luck!
11/24/2009 3:59:30 AM #
You got a really useful blog I have been here reading for about an hour. I am a newbie and your success is very much an inspiration for me.
11/28/2009 5:37:28 AM #
How long has this blog been around? I have been searching for this kind of information for the past week and a half.
11/28/2009 10:09:51 PM #
Hey - nice blog, just looking around some blogs, seems a pretty nice platform you are using. I'm currently using Wordpress for a few of my sites but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?
11/29/2009 6:24:27 AM #
Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.
11/29/2009 10:02:49 PM #
Hello webmaster, awesome blog post. Please keep them coming...
11/30/2009 2:32:07 PM #
Superb article. Bookmarked it already. have a nice day, John T..
12/1/2009 6:00:24 AM #
Have you ever considered adding more videos to your blog posts to keep the readers more entertained? I mean I just read through the entire article of yours and it was quite good but since I'm more of a visual learner,I found that to be more helpful well let me know how it turns out! I love what you guys are always up too. Such clever work and reporting! Keep up the great works guys I've added you guys to my blogroll. This is a great article thanks for sharing this informative information.. I will visit your blog regularly for some latest post.
NLP
12/1/2009 3:41:58 PM #
I was just browsing for related blog posts for my project research and I happened to discover yours. Thanks for the excellent information! Smile
12/3/2009 3:53:07 AM #
Just wanted to give you a shout from the valley of the sun, great information. Much appreciated.
12/7/2009 4:19:42 AM #
Keep 'em coming... you all do such a great job at such Concepts... can't tell you how much I, for one appreciate all you do!
12/9/2009 12:07:15 AM #
Couldn?t be written any better. Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this article to him. Pretty sure he will have a good read. Thanks for sharing!
12/9/2009 4:51:41 AM #
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work.
12/13/2009 12:19:02 AM #
This is my first time i visit here. I found so many interesting stuff in your blog, especially its discussion. From the tons of comments on your posts, I guess I am not the only one having all the leisure here! Keep up the excellent work.
12/14/2009 7:24:26 AM #
This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.
12/15/2009 9:23:25 PM #
There are certainly many more details to take into consideration, but thanks for sharing this post.
12/16/2009 8:09:10 AM #
Great post! I am just starting out in community management/marketing media and trying to learn how to do it well - resources like this article are incredibly helpful. As our company is based in the US, it?s all a bit new to us. The example above is something that I worry about as well, how to show your own genuine enthusiasm and share the fact that your product is useful in that case.
12/19/2009 12:48:55 PM #
Thank you for the great post!
12/26/2009 10:37:39 PM #
Do you make money out of this blog? just curious
12/27/2009 7:01:20 PM #
Thanks for taking the time to discuss this,would you mind updating your blog with more information? It is extremely helpful for me.
12/28/2009 12:17:30 AM #
This is a really good read for me. Must agree that you are one of the best bloggers I ever saw. Thanks for posting this useful article.
12/28/2009 5:24:49 PM #
There are certainly many more details to take into consideration, but thanks for sharing this post.
1/2/2010 7:11:23 PM #
This is a really excellent read for me. Must agree that you are one of the best bloggers I ever saw. Thanks for posting this useful article.
1/2/2010 11:05:01 PM #
I like how you write.Are you interesting in a part time writer job?
1/12/2010 12:20:44 AM #
Took me time to read all the comments, but I really love the article. It proved to be very useful to me and I am sure to all the commenters here! It's always nice when you can not only be informed, but also engaged! I'm sure you had joy writing this article.
1/18/2010 12:11:14 AM #
I found your blog from wikipedia and it is fancy. Thank you for sharing such an awesome blog post!
1/19/2010 4:15:39 PM #
Thanks for taking the time to share this, I feel strongly about it and love reading more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely useful for me.
1/20/2010 6:22:26 PM #
Useful information, many thanks to the author. It is puzzling to me now, but in general, the usefulness and importance is overwhelming. Very much thanks again and good luck!
1/25/2010 11:04:25 PM #
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely helpful for me.
1/27/2010 3:34:57 AM #
Hey mate, fantastic article.. please continue posting!!!
1/28/2010 11:29:19 AM #
You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!
1/29/2010 4:48:17 PM #
Excellent post I must say.. Simple but yet entertaining and engaging.. Keep up the good work!
2/4/2010 1:03:39 AM #
hey admin, I found your website from bing and read some of your other articles. They are first-class. Pleasee keep them coming.. Best regards, Brad R..
2/4/2010 3:45:23 PM #
I wanted to thank you for this excellent read!! I definitely enjoyed every little bit of it. I have you bookmarked your site to check out the latest stuff you post.
2/4/2010 5:45:36 PM #
This is a really good read for me. Must agree that you are one of the best bloggers I ever saw. Thanks for posting this useful article.
2/6/2010 12:27:31 PM #
You have some honest ideas here. I done a research on the issue and discovered most peoples will agree with your blog.
2/6/2010 6:16:51 PM #
This is my first time i go post. I collected so many interesting things in your site especially its discussion. From the tons of comments on your posts, I guess I am not the only one having all the enjoyment here! keep up the good work.Regards
2/6/2010 8:26:01 PM #
Thanks for taking the time to share this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely useful for me.
2/6/2010 11:28:08 PM #
I never saw a pessimistic general win a battle
2/8/2010 12:39:26 PM #
I was just browsing for related blog posts for my project research and I happened to stumble upon yours. Thanks for the useful information! Smile
2/9/2010 11:26:32 AM #
Replica jerseys are becoming rapidly popular as regular attire.You will notice many teenagers donning a Bill Russell or Oscar Robertson jersey in pubs, colleges and discos. In fact,<a href=http://www.jerseysleague.com>nfl jerseys</a>even individuals who are not NFL fans have started wearing these jerseys as a style statement.
<a href=http://www.jerseysleague.com>cheap nfl jerseys</a>
2/9/2010 3:56:42 PM #
By default, environment variables are inherited from a process' parent. However, when a program executes another program, the calling program can set the environment variables to arbitrary values. This is dangerous to setuid/setgid programs, because their invoker can completely control the environment variables they're given.
2/9/2010 7:17:02 PM #
You gave nice ideas here. I done a research on the issue and learnt most peoples will agree with your blog.
2/25/2010 1:33:14 PM #
Just wanted to say thanks for this.
2/26/2010 12:25:43 AM #
I admire the valuable information you offer in your articles. I will bookmark your blog and have my children check up here often. I am quite sure they will learn lots of new stuff here than anybody else!
2/26/2010 3:22:10 PM #
Nice post . keep up the good work
2/27/2010 12:44:03 PM #
I've bookmarked your blog, the articles are way better than other similar blogs.. thanks for a great blog!
2/27/2010 3:39:24 PM #
Please, can you PM me and tell me few more thinks about this, I am really fan of your blog...
2/27/2010 8:54:04 PM #
I've bookmarked your blog, the articles are way better than other similar blogs.. thanks for a great blog!
2/28/2010 1:47:36 AM #
I've bookmarked your blog, the articles are way better than other similar blogs.. thanks for a great blog!
2/28/2010 7:03:42 PM #
Hello, I found your blog in a new directory of blogs. I dont know how your blog came up, must have been a typo, Your blog looks good. Have a nice day.
2/28/2010 9:42:11 PM #
I've bookmarked your blog, the articles are way better than other similar blogs.. thanks for a great blog!
3/1/2010 2:45:55 AM #
Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful.
3/1/2010 4:35:49 PM #
This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work.
3/3/2010 3:34:35 AM #
3/3/2010 9:58:54 AM #
I was looking for this the other day. i dont usually post in forums but i wanted to say thank you!
3/3/2010 7:23:35 PM #
I hold on to your body And feel each move you make Your voice is warm and tender A love that I could not forsake .. thanks for a great blog!
3/3/2010 8:43:00 PM #
Always be a gentleman! Help her take off her coat, show her to her seat, open the door for her, these are just a few things you can do to get the message across that you are the perfect gentleman. Do these things and you will definitely convey to her that you are making an effort. .. thanks for a great blog!
3/4/2010 4:07:34 AM #
Ooh shoot i just wrote a big comment and as soon as i hit reply it came up blank! Please tell me it worked right? I dont want to sumit it again if i do not have to! Either the blog glitced out or i am an idiot, the second option doesnt surprise me lol. thanks for a great blog!
3/4/2010 7:59:45 AM #
I completely agree with the above comment, the internet is with a doubt growing into the most important medium of communication across the globe and its due to sites like this that ideas are spreading so quickly. Big thanks for the useful info i found on Lausdahl.com | Environment variables in Ubuntu.
ugg boots
ugg boots
3/6/2010 3:39:25 PM #

they are very good and useful!!!
http://www.uggs-outlet.org                              ugg outlet
http://www.cheap-uggs-online.net                cheap uggs
http://www.shoesucn.com                                nike shoes
http://www.watchesxm.com                             wholesale watches
3/7/2010 7:52:54 AM #
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work. Big thanks for the useful info i found on Lausdahl.com | Environment variables in Ubuntu.
3/9/2010 9:54:39 AM #
I wanted to say that it's nice to know that someone else also mentioned this as I had trouble finding the same info elsewhere. This was the first place that told me the answer. Thanks.
3/12/2010 11:02:24 AM #
this blog help me a lot.
3/12/2010 6:05:32 PM #
This is my first time i visit here. I found so many interesting stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the good work.
3/16/2010 9:03:02 AM #
Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.
3/18/2010 12:58:52 PM #
Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.
3/18/2010 10:57:41 PM #
Very good article, I found your site through Bing. I bookmarked your site for furture infomation, once I started reading this post I couldn't stop until I became finished, although it wasn't just what I had been searching for, was a nice read though. I will instantly grab your rss feed to stay informed of any updates. Gratifying work!
3/19/2010 12:54:19 AM #
Have you ever considered adding more videos to your blog posts to keep the readers more entertained? I mean I just read through the entire article of yours and it was quite good but since I'm more of a visual learner,I found that to be more helpful well let me know how it turns out!  Big thanks for the useful info i found on Lausdahl.com | Environment variables in Ubuntu.
3/19/2010 12:57:35 AM #
I disagree with most folks here; I was just browsing for related blog posts for my project research and I happened to stumble upon yours. Thanks for the useful information! This is my first time i visit here. I found so many interesting stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! Keep up the good work.
3/19/2010 2:44:54 AM #
Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share.
3/20/2010 4:57:08 AM #
Hi, probably i am being a little bit off topic here, nonetheless I had been checking your website and it appears outstanding. I’m creating a web site and attempting to make it appear clean, however everytime I touch it I wreck something up. Did you design and style the blog by yourself? Can a person with very little experience do it, as well as add updates without messing it up? Anyway, great information on here, extremely helpful.
3/21/2010 2:05:55 AM #
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It's always nice when you can not only be informed, but also entertained! I'm sure you had fun writing this article.
3/21/2010 2:59:07 PM #
Howdy, i read your blog often and i own an analogous one and i used to be simply wondering if you get a lot of spam comments? If thus how do you stop it, any plugin or anything you'll be able to advise? I get thus much lately it's driving me mad so any help is very abundant appreciated.
3/22/2010 8:29:29 PM #
Success is that old ABC - ability, breaks, and courage.
3/27/2010 5:23:38 AM #
Hello. Great job. I did not expect this on a Wednesday. This is a great story.  Big thanks for the useful info i found on Lausdahl.com | Environment variables in Ubuntu.
4/1/2010 10:37:20 AM #
I really impress whith this post
cheap jordan
cheap jordan
4/1/2010 2:47:06 PM #
http://www.nikejordanstore.com Cheap Nike Air Jordan Shoes Wholesale Nike Air Force One
http://www.cheapdunkshoes.com/ cheap wholesale Nike jordan Free shipping
4/2/2010 12:11:30 AM #
This is often a very smart browse on behalf of me, Should admit that you are one in every of the best bloggers I ever saw.Thanks for posting this informative article.
4/3/2010 6:21:26 AM #
Super-Duper site! I am loving it!! Will come back again - taking you feeds also, Thanks.
4/4/2010 2:03:38 PM #
For me this has come as a surprise! I wasn't aware of the many ripples and depth to this story until I surfed here through Google! Great job. But anyway, this is my first visit to your blog! We are a group of volunteers and starting a new initiative in a community in the same niche. Your blog provided us valuable information to work on. You have done a marvellous job!
4/6/2010 1:48:52 AM #
I think is very honest comment, all I can say is thank you for the sensible critique. Me & my neighbour were trying to do some research about that. We got a good book on that matter from our local library and most books where not as influensive as your information. I am very glad to see such information which I was searching for a long time.This made very glad and releived.
4/6/2010 7:50:12 AM #
Thank you for the sensible critique. THANKS A LOT
4/6/2010 8:37:59 AM #
I was searching for a long time.This made very glad and releived.
4/6/2010 12:33:09 PM #
If you're still on the fence: grab your favorite earphones, head down to a Best Buy and ask to plug them into a Zune then an iPod and see which one sounds better to you, and which interface makes you smile more. Then you'll know which is right for you.
4/6/2010 1:57:28 PM #
There are certainly a lot more details to take into consideration, but thanks for sharing this information.
4/6/2010 2:50:51 PM #
Fine information, many thanks to the author. It is puzzling to me now, but in general, the usefulness and importance is overwhelming. Very much thanks again and  best of luck!
4/6/2010 9:58:22 PM #
Valuable information and excellent design you got here! I would like to thank you for sharing your thoughts and time into the stuff you post!! Thumbs up! Big thanks for the useful info i found on Lausdahl.com | Environment variables in Ubuntu.
4/7/2010 5:32:15 AM #
No matter what others say, I think it is still interesting and useful maybe necessary to improve some minor things
4/8/2010 5:47:14 PM #
Took me awhile to read all the comments, but I really enjoyed the article. It proved to be very helpful to me and I am sure to all the commenters here! It's always nice when you can not only be informed, but also engaged! I'm sure you had fun writing this article.
4/11/2010 5:25:18 AM #
I have a awesome sense of humor and I enjoy laughing the light-headed of her jokes.
4/12/2010 8:52:50 AM #
I completely agree with the above comment, the internet is with a doubt growing into the most important medium of communication across the globe and its due to sites like this that ideas are spreading so quickly.
4/12/2010 8:37:35 PM #
This is a really good read for me. Must agree that you are one of the coolest bloggers I ever saw. Thanks for posting this informative article.
4/13/2010 3:55:28 PM #
Took me awhile to read all the comments, but I really love the article. It proved to be very useful to me and I am sure to all the commenters here! It's always nice when you can not only be informed, but also engaged! I'm sure you had fun writing this article.
4/15/2010 4:14:09 PM #
There are certainly many more details to take into consideration, but thanks for sharing this post.
4/15/2010 8:56:10 PM #
This is my first time i visit here. I found so many entertaining stuff in your blog, especially its discussion. From the tons of comments on your posts, I guess I am not the only one having all the leisure here! Keep up the excellent work.
4/20/2010 5:22:20 PM #
This is a really good read for me. Must admit that you are one of the coolest bloggers I ever saw. Thanks for posting this useful article.
4/24/2010 8:07:58 AM #
Perhaps you have considered adding added video clips to your weblog posts to hold the readers further entertained? I mean I just read through the entire article of yours and it had been completely excellent but since I'm more of a visual learner,I found that for being extra helpful well let me know how it turns out! I enjoy what you guys are always up too. Such bright work and reporting! Maintain the great works guys I've added you guys to my blogroll. This is a great article thanks for sharing this informative information.. I'll visit your blog regularly for some latest post.
4/25/2010 2:56:31 PM #
I don't agree with the whole thing on this post, but you do make some very good things. I'm very excited about this subject and I myself perform alot of explore as well. Anyway it had been a well thoughtout & nice read so I figured I would leave you a comment. Feel free to take a look at my web site sometime & let me know what u think.
4/27/2010 3:51:30 PM #
This is my first time i visit here. I found so many interesting stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! Keep up the excellent work.
5/3/2010 3:55:56 PM #
Hi Webmaster, commenters and everybody else !!! The blog was absolutely fantastic! Lots of great information and inspiration, both of which we all need!Keep 'em coming... you all do such a great job at such Concepts... can't tell you how much I, for one appreciate all you do!
5/7/2010 1:07:20 PM #
Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with more information? It is extremely useful for me.
5/7/2010 1:12:31 PM #
There are certainly many more details to take into consideration, but thanks for sharing this information.