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\
  • As a word of caution, changing LANG=C in your .bashrc (depending on your shell) will break some newer GUI console login behavior. It breaks CentOS 7.6, at least. (ask me how I know this) Mar 26, 2019 at 14:20

3 Answers 3


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'

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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