1locale(1) General Commands 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-2008.
93
95 POSIX.1-2001.
96
98 $ locale
99 LANG=en_US.UTF-8
100 LC_CTYPE="en_US.UTF-8"
101 LC_NUMERIC="en_US.UTF-8"
102 LC_TIME="en_US.UTF-8"
103 LC_COLLATE="en_US.UTF-8"
104 LC_MONETARY="en_US.UTF-8"
105 LC_MESSAGES="en_US.UTF-8"
106 LC_PAPER="en_US.UTF-8"
107 LC_NAME="en_US.UTF-8"
108 LC_ADDRESS="en_US.UTF-8"
109 LC_TELEPHONE="en_US.UTF-8"
110 LC_MEASUREMENT="en_US.UTF-8"
111 LC_IDENTIFICATION="en_US.UTF-8"
112 LC_ALL=
113
114 $ locale date_fmt
115 %a %b %e %H:%M:%S %Z %Y
116
117 $ locale -k date_fmt
118 date_fmt="%a %b %e %H:%M:%S %Z %Y"
119
120 $ locale -ck date_fmt
121 LC_TIME
122 date_fmt="%a %b %e %H:%M:%S %Z %Y"
123
124 $ locale LC_TELEPHONE
125 +%c (%a) %l
126 (%a) %l
127 11
128 1
129 UTF-8
130
131 $ locale -k LC_TELEPHONE
132 tel_int_fmt="+%c (%a) %l"
133 tel_dom_fmt="(%a) %l"
134 int_select="11"
135 int_prefix="1"
136 telephone-codeset="UTF-8"
137
138 The following example compiles a custom locale from the ./wrk directory
139 with the localedef(1) utility under the $HOME/.locale directory, then
140 tests the result with the date(1) command, and then sets the environ‐
141 ment variables LOCPATH and LANG in the shell profile file so that the
142 custom locale will be used in the subsequent user sessions:
143
144 $ mkdir -p $HOME/.locale
145 $ I18NPATH=./wrk/ localedef -f UTF-8 -i fi_SE $HOME/.locale/fi_SE.UTF-8
146 $ LOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date
147 $ echo "export LOCPATH=\$HOME/.locale" >> $HOME/.bashrc
148 $ echo "export LANG=fi_SE.UTF-8" >> $HOME/.bashrc
149
151 localedef(1), charmap(5), locale(5), locale(7)
152
153
154
155Linux man-pages 6.04 2023-03-30 locale(1)