| 1 |
.\" Copyright 2014, Michael Kerrisk <[email protected]> |
| 2 |
.\" Copyright, the authors of the Linux man-pages project |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.TH locale 1 2026-02-08 "Linux man-pages 6.18" |
| 7 |
.SH NAME |
| 8 |
locale \- get locale-specific information |
| 9 |
.SH SYNOPSIS |
| 10 |
.SY locale |
| 11 |
.RI [ option ] |
| 12 |
.YS |
| 13 |
.SY locale |
| 14 |
.RI [ option ] |
| 15 |
.B \-a |
| 16 |
.YS |
| 17 |
.SY locale |
| 18 |
.RI [ option ] |
| 19 |
.B \-m |
| 20 |
.YS |
| 21 |
.SY locale |
| 22 |
.RI [ option ] |
| 23 |
.IR name \~.\|.\|. |
| 24 |
.YS |
| 25 |
.SH DESCRIPTION |
| 26 |
The |
| 27 |
.B locale |
| 28 |
command displays information about the current locale, or all locales, |
| 29 |
on standard output. |
| 30 |
.P |
| 31 |
When invoked without arguments, |
| 32 |
.B locale |
| 33 |
displays the current locale settings for each locale category (see |
| 34 |
.BR locale (5)), |
| 35 |
based on the settings of the environment variables that control the locale |
| 36 |
(see |
| 37 |
.BR locale (7)). |
| 38 |
Values for variables set in the environment are printed without double |
| 39 |
quotes, implied values are printed with double quotes. |
| 40 |
.P |
| 41 |
If either the |
| 42 |
.B \-a |
| 43 |
or the |
| 44 |
.B \-m |
| 45 |
option (or one of their long-format equivalents) is specified, |
| 46 |
the behavior is as follows: |
| 47 |
.TP |
| 48 |
.B \-\-all\-locales |
| 49 |
.TQ |
| 50 |
.B \-a |
| 51 |
Display a list of all available locales. |
| 52 |
The |
| 53 |
.B \-v |
| 54 |
option causes the |
| 55 |
.B LC_IDENTIFICATION |
| 56 |
metadata about each locale to be included in the output. |
| 57 |
.TP |
| 58 |
.B \-\-charmaps |
| 59 |
.TQ |
| 60 |
.B \-m |
| 61 |
Display the available charmaps (character set description files). |
| 62 |
To display the current character set for the locale, use |
| 63 |
.IR "locale\ \-c\ charmap" . |
| 64 |
.P |
| 65 |
The |
| 66 |
.B locale |
| 67 |
command can also be provided with one or more arguments, |
| 68 |
which are the names of locale keywords (for example, |
| 69 |
.IR date_fmt , |
| 70 |
.IR ctype\-class\-names , |
| 71 |
.IR yesexpr , |
| 72 |
or |
| 73 |
.IR decimal_point ) |
| 74 |
or locale categories (for example, |
| 75 |
.B LC_CTYPE |
| 76 |
or |
| 77 |
.BR LC_TIME ). |
| 78 |
For each argument, the following is displayed: |
| 79 |
.IP \[bu] 3 |
| 80 |
For a locale keyword, the value of that keyword to be displayed. |
| 81 |
.IP \[bu] |
| 82 |
For a locale category, |
| 83 |
the values of all keywords in that category are displayed. |
| 84 |
.P |
| 85 |
When arguments are supplied, the following options are meaningful: |
| 86 |
.TP |
| 87 |
.B \-\-category\-name |
| 88 |
.TQ |
| 89 |
.B \-c |
| 90 |
For a category name argument, |
| 91 |
write the name of the locale category |
| 92 |
on a separate line preceding the list of keyword values for that category. |
| 93 |
.IP |
| 94 |
For a keyword name argument, |
| 95 |
write the name of the locale category for this keyword |
| 96 |
on a separate line preceding the keyword value. |
| 97 |
.IP |
| 98 |
This option improves readability when multiple name arguments are specified. |
| 99 |
It can be combined with the |
| 100 |
.B \-k |
| 101 |
option. |
| 102 |
.TP |
| 103 |
.B \-\-keyword\-name |
| 104 |
.TQ |
| 105 |
.B \-k |
| 106 |
For each keyword whose value is being displayed, |
| 107 |
include also the name of that keyword, |
| 108 |
so that the output has the format: |
| 109 |
.IP |
| 110 |
.in +4n |
| 111 |
.EX |
| 112 |
.IR keyword =\[dq] value \[dq] |
| 113 |
.EE |
| 114 |
.in |
| 115 |
.P |
| 116 |
The |
| 117 |
.B locale |
| 118 |
command also knows about the following options: |
| 119 |
.TP |
| 120 |
.B \-\-verbose |
| 121 |
.TQ |
| 122 |
.B \-v |
| 123 |
Display additional information for some command-line option and argument |
| 124 |
combinations. |
| 125 |
.TP |
| 126 |
.B \-\-help |
| 127 |
.TQ |
| 128 |
.B \-? |
| 129 |
Display a summary of command-line options and arguments and exit. |
| 130 |
.TP |
| 131 |
.B \-\-usage |
| 132 |
Display a short usage message and exit. |
| 133 |
.TP |
| 134 |
.B \-\-version |
| 135 |
.TQ |
| 136 |
.B \-V |
| 137 |
Display the program version and exit. |
| 138 |
.SH FILES |
| 139 |
.TP |
| 140 |
.I /usr/lib/locale/locale\-archive |
| 141 |
Usual default locale archive location. |
| 142 |
.TP |
| 143 |
.I /usr/share/i18n/locales |
| 144 |
Usual default path for locale definition files. |
| 145 |
.SH STANDARDS |
| 146 |
POSIX.1-2008. |
| 147 |
.SH HISTORY |
| 148 |
POSIX.1-2001. |
| 149 |
.SH EXAMPLES |
| 150 |
.EX |
| 151 |
.RB $ " locale" ; |
| 152 |
LANG=en_US.UTF\-8 |
| 153 |
LC_CTYPE="en_US.UTF\-8" |
| 154 |
LC_NUMERIC="en_US.UTF\-8" |
| 155 |
LC_TIME="en_US.UTF\-8" |
| 156 |
LC_COLLATE="en_US.UTF\-8" |
| 157 |
LC_MONETARY="en_US.UTF\-8" |
| 158 |
LC_MESSAGES="en_US.UTF\-8" |
| 159 |
LC_PAPER="en_US.UTF\-8" |
| 160 |
LC_NAME="en_US.UTF\-8" |
| 161 |
LC_ADDRESS="en_US.UTF\-8" |
| 162 |
LC_TELEPHONE="en_US.UTF\-8" |
| 163 |
LC_MEASUREMENT="en_US.UTF\-8" |
| 164 |
LC_IDENTIFICATION="en_US.UTF\-8" |
| 165 |
LC_ALL= |
| 166 |
.P |
| 167 |
.RB $ " locale date_fmt" ; |
| 168 |
%a %b %e %H:%M:%S %Z %Y |
| 169 |
.P |
| 170 |
.RB $ " locale \-k date_fmt" ; |
| 171 |
date_fmt="%a %b %e %H:%M:%S %Z %Y" |
| 172 |
.P |
| 173 |
.RB $ " locale \-ck date_fmt" ; |
| 174 |
LC_TIME |
| 175 |
date_fmt="%a %b %e %H:%M:%S %Z %Y" |
| 176 |
.P |
| 177 |
.RB $ " locale LC_TELEPHONE" ; |
| 178 |
+%c (%a) %l |
| 179 |
(%a) %l |
| 180 |
11 |
| 181 |
1 |
| 182 |
UTF\-8 |
| 183 |
.P |
| 184 |
.RB $ " locale \-k LC_TELEPHONE" ; |
| 185 |
tel_int_fmt="+%c (%a) %l" |
| 186 |
tel_dom_fmt="(%a) %l" |
| 187 |
int_select="11" |
| 188 |
int_prefix="1" |
| 189 |
telephone\-codeset="UTF\-8" |
| 190 |
.EE |
| 191 |
.P |
| 192 |
The following example compiles a custom locale from the |
| 193 |
.I ./wrk |
| 194 |
directory with the |
| 195 |
.BR localedef (1) |
| 196 |
utility under the |
| 197 |
.I $HOME/.locale |
| 198 |
directory, then tests the result with the |
| 199 |
.BR date (1) |
| 200 |
command, and then sets the environment variables |
| 201 |
.B LOCPATH |
| 202 |
and |
| 203 |
.B LANG |
| 204 |
in the shell profile file so that the custom locale will be used in the |
| 205 |
subsequent user sessions: |
| 206 |
.P |
| 207 |
.EX |
| 208 |
.RB $ " mkdir \-p $HOME/.locale" ; |
| 209 |
.RB $ " I18NPATH=./wrk/ localedef \-f UTF\-8 \-i fi_SE $HOME/.locale/fi_SE.UTF\-8" ; |
| 210 |
.RB $ " LOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF\-8 date" ; |
| 211 |
.RB $ " echo \[dq]export LOCPATH=\[rs]$HOME/.locale\[dq] >> $HOME/.bashrc" ; |
| 212 |
.RB $ " echo \[dq]export LANG=fi_SE.UTF\-8\[dq] >> $HOME/.bashrc" ; |
| 213 |
.EE |
| 214 |
.SH SEE ALSO |
| 215 |
.BR localedef (1), |
| 216 |
.BR charmap (5), |
| 217 |
.BR locale (5), |
| 218 |
.BR locale (7) |