3

To change the locale of the current user like export LANG=en_US.UTF-8.

But this environment variable doesn't affect the root user. When I use sudo the display language remains default.

How can I temporarily change locale for using sudo?

sudo export LANG=en_US.UTF-8 didn't work, probably that is a bash command.

1 Answer 1

3

sudo sanitizes environment before running any command, so unless you save the desired environment variable in /etc/sudoers using env_keep the varible will not be preserved by sudo.

Alternately, for a single command, you can do:

sudo LANG=en_US.UTF-8 some_command

In order to preserve the current environment:

sudo -E some_command

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .