Locale: facet: _ S_create_c_localenamenotvalid Solution
Among many shell scripts, we often see the previous sentence "LC_ALL = C" SAR_CMD = "LC_ALL = C sar-u-B 1 5 | grep-I average" in front of a command. meaning? LC_ALL = C is used to remove all localization settings so that the command can be correctly executed. ------------------------------- In Linux, locale is used to set different language Environments for program running. locale is supported by ansi c. Locale naming rules are <language >_< region>. <character set encoding>, such as zh_CN.UTF-8, zh stands for Chinese, CN stands for mainland China, and UTF-8 stands for character set. In the locale environment, there is a set of variables that represent different settings in the international environment: 1. LC_COLLATE defines the sorting and comparison rules of the environment. 2. LC_CTYPE is used for character classification and string processing. It controls how all characters are processed, including character encoding, whether the characters are single-byte or multi-byte, and how to print them. Is the most important environment variable. 3. LC_MONETARY currency format 4. LC_NUMERIC: the format of non-currency numbers 5. LC_TIME and date format 6. LC_MESSAGES: the language of the prompt message. There is also a LANGUAGE parameter, which is similar to LC_MESSAGES, But once this parameter is set, the LC_MESSAGES parameter will become invalid. The LANGUAGE parameter can be set to multiple languages at the same time, such as "zh_CN.GB18030: zh_CN.GB2312: zh_CN ". 7. The default value of LANGLC _ * is the lowest level. This value is used if LC _ * is not set. Similar to LC_ALL. 8. LC_ALL: it is a macro. If this value is set, this value will overwrite the setting values of all LC. Note that the LANG value is not affected by this macro. C "is the default locale of the system, and" POSIX "is the alias of" C. So when we install a new system, the default locale is C or POSIX. "POSIX": Specifies the minimal environment for C-language translation called the POSIX locale. if setlocale () is not invoked, the POSIX locale is the default "C" Equivalent to "POSIX ". ----------------------------------- How to view the current locale setting? # LocaleHow to change the locale setting? * Via the CDE login locale * As a user-specific locale * As a system default localeTo change the current locale setting, first confirm that the desired locale isinstalled on the system: # locale-adeen_AUen_CAen_UKCIf the desired locale is not in the list, you will need to install theappropriate packages for that locale. see the Note below for more ionionabout locale packages. how to change t He locale via the CDE login locale? On the CDE login banner: Choose options-Your agesunder versions-choose the new localeThe CDE banner will re-cycle and then you can login to the selected locale. NOTE: If a user has a different default locale set in their environment, thethat locale setting will override the selected CDE login locale. how to set a user-specific locale? Note: For sh, ksh: LANG = C; export LANGLC_ALL = C; export LC_ALLFor csh: setenv LANG Csetenv LC_ALL CNote: To set a default locale for a user's environment, set the LANG or LC _ * variables in a user's shell intialization file such as $ HOME /. profile or $ HOME /. cshrcHow to change the locale by setting the system default locale? LANG = CLC_ALL = CExample from the/etc/default/init file: Lines of this file shocould be of the form VAR = value, where VAR is one ofTZ, LANG, or any of the LC _ * environment variables. LANG = CLC_ALL = CNote: The system must be rebooted after making changes to the/etc/default/init file in order for the changes to take effect. how to verify the locale setting? After setting or changing the locale, verify that the locale is set correctly: Check if the locale is set correctly by running the locale command without anyoptions: # localeLANG = CLC_CTYPE = "C" LC_NUMERIC = "C" LC_TIME = "C" LC_COLLATE = "C" LC_MONETARY = "C" LC_MESSAGES = "C" LC_ALL = C