1

Running Fedora 20. Trying to permanently set the LANG and LC_TIME variable with "export". When I run it, it works fine and I can see it was changed. When I reboot, it gets changed back. I am doing all this though the bash shell. I have looked in .bash_profile and .bashrc in my home folder and not seeing anything where its getting this wrong value from. I also checked in /etc - the files profile and bashrc, and in /etc/profile.d/. But I cant seem to figure out where its getting that value from.

1) Where is Fedora getting the LANG and LC_TIME env variable from and how does it know which one to pick?

2) How do I change it permanently for a single user?

3) How can I change it globally(for all users) and make it stick?

4) Why does "export" not make it persistent?

I need to be able to do all of this through the shell. Thanks!

  • Look in /etc/locale.conf. That should be systemwide. – Tom Hunt Sep 2 '15 at 16:23
  • The value I want to use is actually there. But something is overriding it. Its being ignored. – user53029 Sep 2 '15 at 16:26
  • When you say you exported it, you did so in some rc file and not just on the command line, right? What file did you modify? – Andy Dalton Sep 2 '15 at 16:42
  • In bash, I did not edit any files. I ran "export LANG=en_US.utf8" for example. I think this only keeps in in RAM until you close the session. That being said, I just modified my bash_profile file in my home dir with the changes I wanted and it made it persist through reboots. I can probably figure out how to do it globally but I'm still curious where the OS gets its default information from if its not specified in any file? – user53029 Sep 2 '15 at 16:50
  • Something has to be telling the OS to use xyz for the LANG env variable and where to get that. I'd like to know where that's set. – user53029 Sep 2 '15 at 16:52
4

In bash, the "export" builtin will export the variable to the shell process's environment. Any processes started from that shell will inherit the process from that shell.

If you want the envvar to be persistent, you must set it in some place that the software started will inherit from. For the locale related vars, use /etc/locale.conf (manpage). For other variables, you will need to find another place. That place will more than likely depend on what you are trying to set the envvars for.

For example, if you want to set a environment variable for a particular systemd service, you need to add an appropriate "Environment" directive to the system unit file. See here and search for "Environment" for more on that topic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.