16

After making changes to /etc/default/locale, is it possible to reload/active the new settings without a reboot?

  • 1
    Which distribution? Console or GUI? But often reloading /etc/profile or logging in again helps. You usually do not need to reboot a linux system for anything but a kernel update. – ThiefMaster Jan 9 '14 at 9:01
  • centos version 5.7 – ohho Jan 9 '14 at 9:07
10

Locale settings are set as environment variables by the login process (which reads /etc/default/locale) and inherited by child processes. If you log in to a new session, the new settings take effect in the new session.

You can make the settings take effect immediately in a shell by issuing the command

. /etc/default/locale

(note the leading dot). If you've added a category that wasn't set before, you'll need to export it. If you've removed a category, you'll need to unset it.

Changing the settings in a shell affects all the applications subsequently started by that shell (as long as they're using the system locale settings and not their own configuration method).

  • What does the dot does? I there any other uses of it? – lepe Aug 31 '17 at 2:25
  • 1
    @lepe It's a shell builtin to read and interpret the given file. The file is interpreted in the current shell, as opposed to just writing /etc/default/locale which would execute that file as a separate program, which is pointless when all the file does is set variables. – Gilles 'SO- stop being evil' Aug 31 '17 at 6:53
1

If your are using a shell, then just start a new login eg. su youruserid -

test it then exit back to your original login shell

If you are using a gui, logout and login again.

  • su youruserid - - really?! Why not simply exit the shell and restart it?! – ThiefMaster Jan 9 '14 at 10:10
  • Because I would loose my "context", say I was developing a program, then starting a sub shell allows me to test then exit, I am still in the development directory, ready to try again. Of course logout and login will work, but starting a sub shell is quicker in my opinion. – X Tian Jan 9 '14 at 10:17

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.