Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
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 2:06
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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. –  Alistair Buxton Dec 3 '12 at 1:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.