Override Linux shell language
Lars Jönsson 2026-07-07
How to temporary override the language in shell printouts.
Overview
If the locale is other than English, it is sometimes good to be able
to change it to get printouts in English. There are several
environment variables available for changing language settings. You
can view your current locale settings by executing the locale
command.
$ locale
LANG=sv_SE.UTF-8
LC_CTYPE="sv_SE.UTF-8"
LC_NUMERIC="sv_SE.UTF-8"
LC_TIME="sv_SE.UTF-8"
LC_COLLATE="sv_SE.UTF-8"
LC_MONETARY="sv_SE.UTF-8"
LC_MESSAGES="sv_SE.UTF-8"
LC_PAPER="sv_SE.UTF-8"
LC_NAME="sv_SE.UTF-8"
LC_ADDRESS="sv_SE.UTF-8"
LC_TELEPHONE="sv_SE.UTF-8"
LC_MEASUREMENT="sv_SE.UTF-8"
LC_IDENTIFICATION="sv_SE.UTF-8"
LC_ALL=
To change all locale settings to English, use LANG=C. This C
locale is always available without installing additional language
packs. Even though it possible to just change LC_MESSAGES, which
only affect messages, it is much easier to use LANG.
Usage
Override a single command
Prepend the command with LANG=C to temporary change the locale to
English.
$ LANG=C ls /nonexistent
ls: cannot access '/nonexistent': No such file or directory
Without the override, it will use the current locale.
$ ls /nonexistent
ls: kan inte komma åt '/nonexistent': Filen eller katalogen finns inte
Override multiple commands
If multiple commands needs to temporary change the locale to English, it is easier to change it once. The new locale will be used until the shell is exits or the locale is changed again.
Change the locale, but first print the current locale.
$ echo $LANG
sv_SE.UTF-8
$ LANG=C
Now the commands will use English printouts.
$ ls /nonexistent
ls: cannot access '/nonexistent': No such file or directory
$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=
Either exit the shell or restore the locale.
$ LANG=sv_SE.UTF-8