I came across this wiki page: Package Manager Troubleshooting Procedure.

In it, there were commands such as:

LANG=C;sudo apt-get clean
LANG=C;sudo apt-get autoclean
LANG=C;sudo apt-get -f install
LANG=C;sudo apt-get --fix-missing install
LANG=C;sudo apt-get --purge autoremove
LANG=C;sudo apt-get --fix-missing update -o APT::Cache-Limit=100000000
LANG=C;sudo apt-get update -o APT::Cache-Limit=100000000 && sudo apt-get dist-upgrade

So what is the purpose of LANG=C;?

  • 3
  • 8
    Please note that that document is using the command incorrectly - it should be LANG=C command and not LANG=C;command. The first form forces the value of LANG environment variable for the duration of command while the second form is actually two commands where the first part just sets a local (not exported) variable and the second part runs the command without setting the required environment variable. – Guss Jan 26 '16 at 22:59
  • 2
    @Guss: Actually it works also with the semicolon. Why? Because LANG is an existing environment variable when you open the terminal window, and if you change its value as a separate command, that value will be the effective environment variable until you change it again or the process ends. – Gunnar Hjalmarsson Jan 27 '16 at 2:03
  • 3
    @Gunnar - it is incorrect: Probably LANG is in the environment, so it probably works with redundant semicolons; but it is (1) redundant because nothing is going to change LANG between the commands. Also hinting somebody to run commands in such way is (2) wrong because of unnecessarily and uninvited changing environment, and (3) this provides an incorrect pattern for any uninformed user that later reapplies the usage - possibly with a shell variable that is not in the environment and thus not even having any effect on the commands run that require it for correct, perhaps safe, function. – FooF Jan 27 '16 at 4:56
  • 2
    @Braiam I'm familiar with the syntax, but it's important to note that unless the variable is exported, the command will not see it. LANG is a standard environment variable and so exported by default - but other variables may not be and the OP should be aware of that. – Guss Jan 27 '16 at 11:09

If you're troubleshooting, you'll likely post your results in some forum, or here, sooner or later.

When that happens, it's much more simpler for other users to understand your logs and output, if they're not internationalised.

That's to say, if you're using French or Chinese or Hindi or whatever as your system language, the output is likely to use terms in that language, and that makes it all the more harder to understand what's going on.

The C locale forces default output (which is typically ASCII-only English).

It's best to start a troubleshooting session with:

export LC_ALL=C

Instead of setting specific locale variables, or setting it just for a specific command.


LANG=C will make your terminal output fall-back to the default locale. As this guide suggests you sending your output to Launchpad for support, they are having you do this so that, when you paste it in, others will be able to read it no matter what language you usually use.


A small addition although it probably doesn't apply in the case of apt as I regard it as a quite stable piece of software:

Some programs notoriosly misbehave when using a different setting for LANG (or atleast different from C or en_US).

Unity had (still has?) these issues (and Unity-based games), Unreal Engine had some problems too. Also some of the build-scripts for Android only ran with LANG=C properly or compiled only with this environment variable set this way.

So this could also help troubleshooting as the bug might not even occur with this setting.

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.