LANG=C is in a number of the /etc/init.d/* scripts. What does LANG=C do and why do you need to set LANG=C.
It forces applications to use the default language for output, and forces sorting to be bytewise.
$ LANG=es_ES man
¿Qué página de manual desea?
$ LANG=C man
What manual page do you want?
$ LANG=en_US sort <<< $'a\nb\nA\nB'
a
A
b
B
$ LANG=C sort <<< $'a\nb\nA\nB'
A
B
a
b
As already explained, the LANG
environment variable controls localization.
It affects many standard command-line tools like sort
, grep
, awk
.
Setting its value to "C" tells all those tools to consider only basic ASCII characters and disable UTF-8 multibyte match.
Another good reason than localisation to use that environment variable is performance: it can make grep
1000 times faster for grep
versions < 2.7 : http://rg03.wordpress.com/2009/09/09/gnu-grep-is-slow-on-utf-8/
On the reason why the letter "C" is used to specify a "safe" basic locale, see Why "LANG=C"? (not D or E or F).
LANG=C is a way to disable localization. It's used in scripts to predict program output which may vary based on current language. For more information read this