1 LOCALE(1)                        User Commands                       LOCALE(1)
   2 
   3 
   4 
   5 NAME
   6        locale - get locale-specific information
   7 
   8 SYNOPSIS
   9        locale [-a | -m]
  10 
  11 
  12        locale [-ck] name...
  13 
  14 
  15 DESCRIPTION
  16        The locale utility writes information about the current locale
  17        environment, or all public locales, to the standard output. For the
  18        purposes of this section, a public locale is one provided by the
  19        implementation that is accessible to the application.
  20 
  21 
  22        When locale is invoked without any arguments, it summarizes the current
  23        locale environment for each locale category as determined by the
  24        settings of the environment variables.
  25 
  26 
  27        When invoked with operands, it writes values that have been assigned to
  28        the keywords in the locale categories, as follows:
  29 
  30            o      Specifying a keyword name selects the named keyword and the
  31                   category containing that keyword.
  32 
  33            o      Specifying a category name selects the named category and
  34                   all keywords in that category.
  35 
  36 OPTIONS
  37        The following options are supported:
  38 
  39        -a
  40              Writes information about all available public locales. The
  41              available locales include POSIX, representing the POSIX locale.
  42 
  43 
  44        -c
  45              Writes the names of selected locale categories. The -c option
  46              increases readability when more than one category is selected
  47              (for example, via more than one keyword name or via a category
  48              name). It is valid both with and without the -k option.
  49 
  50 
  51        -k
  52              Writes the names and values of selected keywords. The
  53              implementation may omit values for some keywords; see OPERANDS.
  54 
  55 
  56        -m
  57              Writes names of available charmaps; see  localedef(1).
  58 
  59 
  60 OPERANDS
  61        The following operand is supported:
  62 
  63        name
  64                The name of a locale category, the name of a keyword in a
  65                locale category, or the reserved name charmap. The named
  66                category or keyword will be selected for output. If a single
  67                name represents both a locale category name and a keyword name
  68                in the current locale, the results are unspecified; otherwise,
  69                both category and keyword names can be specified as name
  70                operands, in any sequence.
  71 
  72 
  73 EXAMPLES
  74        Example 1 Examples of the locale utility
  75 
  76 
  77        In the following examples, the assumption is that locale environment
  78        variables are set as follows:
  79 
  80 
  81          LANG=locale_x LC_COLLATE=locale_y
  82 
  83 
  84 
  85 
  86        The command locale would result in the following output:
  87 
  88 
  89          LANG=locale_x
  90          LC_CTYPE="locale_x"
  91          LC_NUMERIC="locale_x"
  92          LC_TIME="locale_x"
  93          LC_COLLATE=locale_y
  94          LC_MONETARY="locale_x"
  95          LC_MESSAGES="locale_x"
  96          LC_ALL=
  97 
  98 
  99 
 100 
 101        The command
 102 
 103 
 104          LC_ALL=POSIX locale -ck decimal_point
 105 
 106 
 107 
 108 
 109        would produce:
 110 
 111 
 112          LC_NUMERIC
 113          decimal_point="."
 114 
 115 
 116 
 117 
 118        The following command shows an application of locale to determine
 119        whether a user-supplied response is affirmative:
 120 
 121 
 122          if printf "%s\n" "$response" | /usr/bin/grep -Eq\
 123                  "$(locale yesexpr)"
 124          then
 125              affirmative processing goes here
 126          else
 127              non-affirmative processing goes here
 128          fi
 129 
 130 
 131 
 132 ENVIRONMENT VARIABLES
 133        See environ(5) for the descriptions of  LANG, LC_ALL, LC_CTYPE,
 134        LC_MESSAGES, and NLSPATH.
 135 
 136 
 137        The LANG, LC_*, and NLSPATH environment variables must specify the
 138        current locale environment to be written out. These environment
 139        variables will be used if the -a option is not specified.
 140 
 141 EXIT STATUS
 142        The following exit values are returned:
 143 
 144        0
 145              All the requested information was found and output successfully.
 146 
 147 
 148        >0
 149              An error occurred.
 150 
 151 
 152 ATTRIBUTES
 153        See attributes(5) for descriptions of the following attributes:
 154 
 155 
 156 
 157 
 158        +--------------------+-----------------+
 159        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 160        +--------------------+-----------------+
 161        |CSI                 | Enabled         |
 162        +--------------------+-----------------+
 163        |Interface Stability | Standard        |
 164        +--------------------+-----------------+
 165 
 166 SEE ALSO
 167        localedef(1), attributes(5), charmap(5), environ(5), locale(5),
 168        standards(5)
 169 
 170 NOTES
 171        If LC_CTYPE or keywords in the category LC_CTYPE are specified, only
 172        the values in the range 0x00-0x7f are written out.
 173 
 174 
 175        If LC_COLLATE or keywords in the category LC_COLLATE are specified, no
 176        actual values are written out.
 177 
 178 
 179 
 180                                November 28, 2017                     LOCALE(1)