set locale on commandline without system-config-language
Posted: 2011/07/23 12:47:38
Dear others,
i'm proud and relieved user of a fresh CentOS6 installation, which is running as minimal installation (no X) with the determination to be server soon.
I installed using the GUI-mode (still highly disappointed that text-mode does not provide all the crucial features any longer, which i deem totally uncool, ungeeky and un-enterprise, REDHAT!).
I had chosen english (US) as interface language, the only german thing i picked during installation was keyboard layout and timezone (UTC Europe Berlin).
Now: when i log in (as root or any other local account), the system's default locale is "en_EN.UTF-8" as expected, but for all users the (effective) locale is "de_DE.UTF-8".
I dont want this.
Usually i would heal this via "system-config-language",
but 1st) this is for wimps,
and 2nd) this would have to be installed before, loading "lot" of stuff i don't want on my server (some x-libs, pango, ...), all just for setting my language? NO!
A 2nd) attempt using "setlocale" also failed with the same phenomen (specimen below) that all users encounter, who also misunderstood, that this is used on the command line (which is wrong i now guess).
The 3rd) solution: to set an english locale actively via "export" in my bash_profile works of course, but would leave me dump, not knowing where CentOS-system actually configures the user's locale?!?
I skimmed all the promising files (skeleton, profile, ...), but to no avail.
Thus: geeks to the rescue: where does RHEL-class systems set user's locale/language which obviously subersedes the system's default setting done in "/etc/sysconfig/i18n"?
Eagerly waiting for the solution:
cheers
janxy
=====================================
[root@w ~]# env
HOSTNAME= ...
SELINUX_ROLE_REQUESTED=
TERM=xterm-color
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=SELINUX_USE_CURRENT_RANGE=
SSH_TTY=/dev/pts/0
USER=root
LS_COLORS=rs=0:di= ...
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
PWD=/root
LANG=de_DE.UTF-8
SELINUX_LEVEL_REQUESTED=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION= ...
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env
=====================================
=====================================
[root@w ~]# locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
[root@w ~]# cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
[root@w ~]#
=====================================
=====================================
[root@w ~]# cat .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
=====================================
=====================================
[root@w ~]# cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
#unset LANG
[root@w ~]#
=====================================
=====================================
[root@w ~]# setlocale en_US.utf-8
-bash: setlocale: Kommando nicht gefunden.
[root@w ~]#
=====================================
i'm proud and relieved user of a fresh CentOS6 installation, which is running as minimal installation (no X) with the determination to be server soon.
I installed using the GUI-mode (still highly disappointed that text-mode does not provide all the crucial features any longer, which i deem totally uncool, ungeeky and un-enterprise, REDHAT!).
I had chosen english (US) as interface language, the only german thing i picked during installation was keyboard layout and timezone (UTC Europe Berlin).
Now: when i log in (as root or any other local account), the system's default locale is "en_EN.UTF-8" as expected, but for all users the (effective) locale is "de_DE.UTF-8".
I dont want this.
Usually i would heal this via "system-config-language",
but 1st) this is for wimps,
and 2nd) this would have to be installed before, loading "lot" of stuff i don't want on my server (some x-libs, pango, ...), all just for setting my language? NO!
A 2nd) attempt using "setlocale" also failed with the same phenomen (specimen below) that all users encounter, who also misunderstood, that this is used on the command line (which is wrong i now guess).
The 3rd) solution: to set an english locale actively via "export" in my bash_profile works of course, but would leave me dump, not knowing where CentOS-system actually configures the user's locale?!?
I skimmed all the promising files (skeleton, profile, ...), but to no avail.
Thus: geeks to the rescue: where does RHEL-class systems set user's locale/language which obviously subersedes the system's default setting done in "/etc/sysconfig/i18n"?
Eagerly waiting for the solution:
cheers
janxy
=====================================
[root@w ~]# env
HOSTNAME= ...
SELINUX_ROLE_REQUESTED=
TERM=xterm-color
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=SELINUX_USE_CURRENT_RANGE=
SSH_TTY=/dev/pts/0
USER=root
LS_COLORS=rs=0:di= ...
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
PWD=/root
LANG=de_DE.UTF-8
SELINUX_LEVEL_REQUESTED=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION= ...
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env
=====================================
=====================================
[root@w ~]# locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
[root@w ~]# cat /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
[root@w ~]#
=====================================
=====================================
[root@w ~]# cat .bashrc
# .bashrc
# User specific aliases and functions
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
=====================================
=====================================
[root@w ~]# cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
#unset LANG
[root@w ~]#
=====================================
=====================================
[root@w ~]# setlocale en_US.utf-8
-bash: setlocale: Kommando nicht gefunden.
[root@w ~]#
=====================================