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
    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... – Alistair Buxton Nov 23 '12 at 02:06

1 Answers1

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.

dobey
  • 40,982
  • 1
    LANG=es_ES doesn't actually work if you don't have that locale installed, but this is the confirmation I was looking for. LANG=C gives the built-in strings always. – Alistair Buxton Dec 03 '12 at 01:01