4

When helping someone we often ask them to show the output of a command eg:

sudo fdisk -l | pastebinit

If the user is not using an English locale, the output may be in a foreign language:

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 huvuden, 63 sektorer/spår, 91201 cylindrar, totalt 1465149168 sektor

This complicates support. How can one run a command with an override on the system locale to get English output?

1
  • 1
    The answer is something like "LANG=C sudo fdisk -l | pastebinit" but I can't remember the exact, and google is failing me, plus I can't test because I use English... Nov 23, 2012 at 2:06

1 Answer 1

6

The environment variables to override with the locale you wish to use are LANG, LC_ALL, and LANGUAGE. Some apps will handle some of these differently, but generally just setting LANG should work. You can run a command in the terminal with it, like LANG=es_ES locale. The locale command will show the current environment variable settings for your locale.

1
  • 1
    LANG=es_ES <command> doesn't actually work if you don't have that locale installed, but this is the confirmation I was looking for. LANG=C <command> gives the built-in strings always. Dec 3, 2012 at 1:01

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.