1LOCALE(1) Linux User Manual LOCALE(1)
2
3
4
6 locale - get locale-specific information
7
9 locale [option]
10 locale [option] -a
11 locale [option] -m
12 locale [option] name...
13
15 The locale command displays information about the current locale, or
16 all locales, on standard output.
17
18 When invoked without arguments, locale displays the current locale set‐
19 tings for each locale category (see locale(5)), based on the settings
20 of the environment variables that control the locale (see locale(7)).
21 Values for variables set in the environment are printed without double
22 quotes, implied values are printed with double quotes.
23
24 If either the -a or the -m option (or one of their long-format equiva‐
25 lents) is specified, the behavior is as follows:
26
27 -a, --all-locales
28 Display a list of all available locales. The -v option causes
29 the LC_IDENTIFICATION metadata about each locale to be included
30 in the output.
31
32 -m, --charmaps
33 Display the available charmaps (character set description
34 files). To display the current character set for the locale,
35 use locale -c charmap.
36
37 The locale command can also be provided with one or more arguments,
38 which are the names of locale keywords (for example, date_fmt,
39 ctype-class-names, yesexpr, or decimal_point) or locale categories (for
40 example, LC_CTYPE or LC_TIME). For each argument, the following is
41 displayed:
42
43 * For a locale keyword, the value of that keyword to be displayed.
44
45 * For a locale category, the values of all keywords in that category
46 are displayed.
47
48 When arguments are supplied, the following options are meaningful:
49
50 -c, --category-name
51 For a category name argument, write the name of the locale cate‐
52 gory on a separate line preceding the list of keyword values for
53 that category.
54
55 For a keyword name argument, write the name of the locale cate‐
56 gory for this keyword on a separate line preceding the keyword
57 value.
58
59 This option improves readability when multiple name arguments
60 are specified. It can be combined with the -k option.
61
62 -k, --keyword-name
63 For each keyword whose value is being displayed, include also
64 the name of that keyword, so that the output has the format:
65
66 keyword="value"
67
68 The locale command also knows about the following options:
69
70 -v, --verbose
71 Display additional information for some command-line option and
72 argument combinations.
73
74 -?, --help
75 Display a summary of command-line options and arguments and
76 exit.
77
78 --usage
79 Display a short usage message and exit.
80
81 -V, --version
82 Display the program version and exit.
83
85 /usr/lib/locale/locale-archive
86 Usual default locale archive location.
87
88 /usr/share/i18n/locales
89 Usual default path for locale definition files.
90
92 POSIX.1-2001, POSIX.1-2008.
93
95 $ locale
96 LANG=en_US.UTF-8
97 LC_CTYPE="en_US.UTF-8"
98 LC_NUMERIC="en_US.UTF-8"
99 LC_TIME="en_US.UTF-8"
100 LC_COLLATE="en_US.UTF-8"
101 LC_MONETARY="en_US.UTF-8"
102 LC_MESSAGES="en_US.UTF-8"
103 LC_PAPER="en_US.UTF-8"
104 LC_NAME="en_US.UTF-8"
105 LC_ADDRESS="en_US.UTF-8"
106 LC_TELEPHONE="en_US.UTF-8"
107 LC_MEASUREMENT="en_US.UTF-8"
108 LC_IDENTIFICATION="en_US.UTF-8"
109 LC_ALL=
110
111 $ locale date_fmt
112 %a %b %e %H:%M:%S %Z %Y
113
114 $ locale -k date_fmt
115 date_fmt="%a %b %e %H:%M:%S %Z %Y"
116
117 $ locale -ck date_fmt
118 LC_TIME
119 date_fmt="%a %b %e %H:%M:%S %Z %Y"
120
121 $ locale LC_TELEPHONE
122 +%c (%a) %l
123 (%a) %l
124 11
125 1
126 UTF-8
127
128 $ locale -k LC_TELEPHONE
129 tel_int_fmt="+%c (%a) %l"
130 tel_dom_fmt="(%a) %l"
131 int_select="11"
132 int_prefix="1"
133 telephone-codeset="UTF-8"
134
135 The following example compiles a custom locale from the ./wrk directory
136 with the localedef(1) utility under the $HOME/.locale directory, then
137 tests the result with the date(1) command, and then sets the environ‐
138 ment variables LOCPATH and LANG in the shell profile file so that the
139 custom locale will be used in the subsequent user sessions:
140
141 $ mkdir -p $HOME/.locale
142 $ I18NPATH=./wrk/ localedef -f UTF-8 -i fi_SE $HOME/.locale/fi_SE.UTF-8
143 $ LOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date
144 $ echo "export LOCPATH=\$HOME/.locale" >> $HOME/.bashrc
145 $ echo "export LANG=fi_SE.UTF-8" >> $HOME/.bashrc
146
148 localedef(1), charmap(5), locale(5), locale(7)
149
151 This page is part of release 5.13 of the Linux man-pages project. A
152 description of the project, information about reporting bugs, and the
153 latest version of this page, can be found at
154 https://www.kernel.org/doc/man-pages/.
155
156
157
158Linux 2021-03-22 LOCALE(1)