After making changes to /etc/default/locale
, is it possible to reload/active the new settings without a reboot?
2 Answers
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).
-
-
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. Aug 31, 2017 at 6:53 -
-
Sourcing the locale file will not reset existing environment variables unless they are explicitly given in /etc/default/locale. Furthermore, variables given will not be exported, so this does not work correctly unless the current and new configuration is very similar. Jun 30, 2022 at 12:46
-
This did not work for me on Debian, for example the PostgreSQL command pg_lsclusters was still complaining about unset locale variables. So I had to reboot. By reading the answer again, I noticed the other solution with export. It could be useful to mention above the first solution with the dot instead of below that it will not work in some cases, so people will not think it will work when trying it.– baptxNov 10, 2022 at 14:35
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?! Jan 9, 2014 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 TianJan 9, 2014 at 10:17
/etc/profile
or logging in again helps. You usually do not need to reboot a linux system for anything but a kernel update.