LOCALE(1)LOCALE(1)NAMElocale - get locale-specific information
SYNOPSISlocale [-a | -m]
locale [-ck] name...
The locale utility writes information about the current locale environ‐
ment, or all public locales, to the standard output. For the purposes
of this section, a public locale is one provided by the implementation
that is accessible to the application.
When locale is invoked without any arguments, it summarizes the current
locale environment for each locale category as determined by the set‐
tings of the environment variables.
When invoked with operands, it writes values that have been assigned to
the keywords in the locale categories, as follows:
o Specifying a keyword name selects the named keyword and the
category containing that keyword.
o Specifying a category name selects the named category and
all keywords in that category.
The following options are supported:
Writes information about all available public locales. The avail‐
able locales include POSIX, representing the POSIX locale.
Writes the names of selected locale categories. The -c option
increases readability when more than one category is selected
(for example, via more than one keyword name or via a category
name). It is valid both with and without the -k option.
Writes the names and values of selected keywords. The implementa‐
tion may omit values for some keywords; see OPERANDS.
Writes names of available charmaps; see localedef(1).
The following operand is supported:
The name of a locale category, the name of a keyword in a
locale category, or the reserved name charmap. The named cate‐
gory or keyword will be selected for output. If a single name
represents both a locale category name and a keyword name in
the current locale, the results are unspecified; otherwise,
both category and keyword names can be specified as name oper‐
ands, in any sequence.
Example 1 Examples of the locale utility
In the following examples, the assumption is that locale environment
variables are set as follows:
The command locale would result in the following output:
LC_ALL=POSIX locale-ck decimal_point
The following command shows an application of locale to determine
whether a user-supplied response is affirmative:
if printf "%s\n" "$response" | /usr/xpg4/bin/grep -Eq\
affirmative processing goes here
non-affirmative processing goes here
See environ(5) for the descriptions of LANG, LC_ALL, LC_CTYPE, LC_MES‐
SAGES, and NLSPATH.
The LANG, LC_*, and NLSPATH environment variables must specify the cur‐
rent locale environment to be written out. These environment variables
will be used if the -a option is not specified.
The following exit values are returned:
All the requested information was found and output successfully.
An error occurred.
See attributes(5) for descriptions of the following attributes:
│ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
│CSI │ Enabled │
│Interface Stability │ Standard │
SEE ALSOlocaledef(1), attributes(5), charmap(5), environ(5), locale(5), stan‐
If LC_CTYPE or keywords in the category LC_CTYPE are specified, only
the values in the range 0x00-0x7f are written out.
If LC_COLLATE or keywords in the category LC_COLLATE are specified, no
actual values are written out.
Dec 20, 1996 LOCALE(1)