Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Its not clear what it does or what it contains. I tried greping the out put of set and env to see what C or LANG are set to in other places on the systems. Nothing was clear about how it is used or set. I don't even know what man page I should even start reading.

Any help here would be great as I try to decode the start up scripts on different Linux machines. If any one can recommend a good resources (books,documentation) that would help along this process That would be much appreciated.

Example of scripts using LANG=C on a centos6 machine

$ grep -i LANG=C ./*
./halt:LANG=C __umount_loop '$2 ~ /^\/$|^\/proc|^\/dev/{next}
./netconsole:   route=$(LANG=C ip -o route get to $host/32)
./netconsole:           arp=$(LANG=C /sbin/arping -c 1 -I $DEV $target 2>/dev/null | awk '/ reply from .*[.*]/ { print gensub(".* reply from .* \\[(.*)\\].*","\\1","G") }')
./netconsole:                   SYSLOGADDR=$(LANG=C host $SYSLOGADDR 2>/dev/null | awk '/has address / { print $NF }')
./network:          LANG=C sed -e "$__sed_discard_ignored_files" \
./network:          LANG=C sort -k 1,1 -k 2n | \
./network:          LANG=C sed 's/ //')
./network:              eval $(LANG=C fgrep "DEVICE=" ifcfg-$i)
./network:              eval $(LANG=C fgrep "TYPE=" ifcfg-$i)
./network:              eval $(LANG=C fgrep "SLAVE=" ifcfg-$i)
./network:              if LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i > /dev/null ; then
./network:            if ! LANG=C egrep -L "^ONBOOT=['\"]?[Nn][Oo]['\"]?" ifcfg-$i >/dev/null 2>&1 ; then
./network:              eval $(LANG=C fgrep "DEVICE=" ifcfg-$i)
./network:              eval $(LANG=C fgrep "TYPE=" ifcfg-$i)
./rpcbind:# We can't Japanese on normal console at boot time, so force LANG=C.
./rpcbind:        LANG=C

Example useage in scripts on a ubuntu 10.04 machine

$ grep -i LANG=C ./*
./apache2:ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
./ntop:export LANG=C\
share|improve this question
up vote 9 down vote accepted

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'
$ LANG=C sort <<< $'a\nb\nA\nB'
share|improve this answer
Thanks for the example of how it works. Really useful. – nelaar Sep 13 '11 at 12:02

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

share|improve this answer

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 :

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).

share|improve this answer

Your Answer


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.