LOCALECTL(1)

๐Ÿ’– LOCALECTL ๐Ÿ’– (that's the localectl manual, section 1, bestie)

okay so quick vibe check: you're reading the LOCALECTL(1) page. it's about locale stuff and keyboard stuff and honestly? it's giving sysadmin glow-up. let's go ๐ŸŒธ


โœจ NAME โœจ

localectl โ€” control the system locale and keyboard layout settings ๐Ÿ’…


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

localectl [OPTIONS...] {COMMAND}

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so like, localectl is the girl you call when you wanna query and change the system locale and keyboard layout settings. she doesn't do it alone tho โ€” she talks to systemd-localed(8) to go modify files like /etc/locale.conf and /etc/vconsole.conf. teamwork makes the dream work fr fr ๐Ÿซถ

the system locale controls the language settings of system services and of the UI before the user logs in โ€” think display manager โ€” and it's also the default for users after they log in. so basically it's the main character of your language settings, no cap ๐Ÿ‘‘

the keyboard settings control the keyboard layout used on the text console and of the graphical UI before the user logs in (display manager again, iconic), and also the default for users after login. your keyboard, your rules ๐Ÿ’…

โš ๏ธ heads up bestie โ€” changes you make with this tool might require the initrd to be rebuilt for them to actually take effect during early system boot. and no, localectl does not rebuild the initrd automatically. that's a manual task, usually done by reinstalling the distribution's kernel package. not me forgetting that step every single time ๐Ÿ˜ญ
๐ŸŒˆ also note: systemd-firstboot(1) may be used to initialize the system locale for mounted (but not booted) system images. different situation, different girlie.

๐Ÿ‘‘ COMMANDS ๐Ÿ‘‘

here's the lineup, these are the commands that are understood:

  • status โ€” shows you the current settings of the system locale and keyboard mapping. and if you don't specify any command at all? this one is the implied default. she just shows up uninvited, love that for her โœจ

Added in version 195.

  • set-locale LOCALE, set-locale VARIABLE=LOCALE... โ€” sets the system locale. you can hand her one locale like "en_US.UTF-8", or one or more locale assignments like "LANG=de_DE.utf8", "LC_MESSAGES=en_GB.utf8", and so on. if you give just one locale with no variable name, then the "LANG=" locale variable gets set. see locale(7) for all the deets on the available settings and what they mean. and use list-locales to see what locales you actually have (it's below, keep scrolling ๐Ÿ’–)

Added in version 195.

  • list-locales โ€” lists the available locales that are useful for configuring with set-locale. window shopping, but for locales ๐Ÿ›๏ธ

Added in version 195.

  • set-keymap MAP [TOGGLEMAP] โ€” sets the system keyboard mapping for the console and X11. takes a mapping name (like "de" or "us"), and possibly a second one to define a toggle keyboard mapping. unless --no-convert is passed, the selected setting also gets applied as the default system keyboard mapping of X11, after converting it to the closest matching X11 keyboard mapping. use list-keymaps for a list of available keyboard mappings (below, bestie โฌ‡๏ธ)

Added in version 195.

  • list-keymaps โ€” lists available keyboard mappings for the console, useful for configuring with set-keymap. ๐Ÿ’…

Added in version 195.

  • set-x11-keymap LAYOUT [MODEL [VARIANT [OPTIONS]]] โ€” sets the system default keyboard mapping for X11 and the virtual console. takes a keyboard mapping name (like "de" or "us"), and possibly a model, variant, and options โ€” see kbd(4) for details. unless --no-convert is passed, the selected setting also gets applied as the system console keyboard mapping, after converting it to the closest matching console keyboard mapping. she converts, she slays ๐Ÿ”ฅ

Added in version 195.

  • list-x11-keymap-models, list-x11-keymap-layouts, list-x11-keymap-variants [LAYOUT], list-x11-keymap-options โ€” lists available X11 keymap models, layouts, variants and options, useful for configuring with set-keymap. the list-x11-keymap-variants command optionally takes a layout parameter to limit the output to only the variants that are suitable for that specific layout. picky, but make it fashion ๐Ÿ’…

Added in version 201.


๐ŸŒธ OPTIONS ๐ŸŒธ

these are the options that are understood:

  • -l, --full โ€” do not ellipsize the output. give me the WHOLE thing, no cutting off, we don't do cropped over here โœ‚๏ธ๐Ÿšซ

Added in version 257.

  • --no-convert โ€” if set-keymap or set-x11-keymap is invoked and this option is passed, then the keymap will not be converted from the console to X11, or from X11 to console, respectively. you're saying "no thank you, I'll take it as-is" ๐Ÿ’…

Added in version 195.

  • -H, --host= โ€” execute the operation remotely. specify a hostname, or a username and hostname separated by "@", to connect to. the hostname may optionally be suffixed by a port ssh is listening on, separated by ":", and then a container name, separated by "/", which connects directly to a specific container on the specified host. this uses SSH to talk to the remote machine manager instance. container names may be enumerated with machinectl -H HOST. and put IPv6 addresses in brackets, okay? brackets. ๐Ÿซถ
  • -M, --machine= โ€” execute operation on a local container. specify a container name to connect to, optionally prefixed by a user name to connect as and a separating "@" character. if the special string ".host" is used in place of the container name, a connection to the local system is made (which is useful to connect to a specific user's user bus: "--user --machine=lennart@.host"). if the "@" syntax is not used, the connection is made as root user. if the "@" syntax is used, either the left hand side or the right hand side may be omitted (but not both) โ€” in that case the local user name and ".host" are implied. so many little rules but honestly? it's giving attention to detail ๐Ÿ’…
  • --no-ask-password โ€” do not query the user for authentication for privileged operations. no popups, no interruptions, just vibes ๐Ÿฆ‹
  • -h, --help โ€” print a short help text and exit. the classic "what does this even do" move ๐Ÿ˜ญ
  • --version โ€” print a short version string and exit. ๐Ÿ“Œ
  • --no-pager โ€” do not pipe output into a pager. dump it straight to the terminal, we die like real ones ๐Ÿ’€

๐Ÿงš EXIT STATUS ๐Ÿงš

on success, 0 is returned. a non-zero failure code otherwise. that's it, that's the whole thing. 0 = slay, anything else = we have a problem โœจ

  • $SYSTEMD_LOG_LEVEL โ€” the max log level of messages that get emitted, meaning anything with a higher log level (aka less important, aka the lil drama-free ones) gets straight-up suppressed. ๐Ÿ’ค It takes a comma-separated list of values, and each value is either one of these (listed in order of decreasing importance) โ€” emerg, alert, crit, err, warning, notice, info, debug โ€” or just an integer in the range 0...7. Peep syslog(3) for the whole lore. Each value can also be prefixed with one of console, syslog, kmsg or journal followed by a colon, which sets the max log level for that one specific log target, like SYSTEMD_LOG_LEVEL=debug,console:info โ€” that one says "log at debug level everywhere except the console, which should be at info level." Note bestie: the global max log level takes priority over any per-target max log levels. No cap. ๐Ÿ‘‘
  • $SYSTEMD_LOG_COLOR โ€” a boolean. If it's true, messages written to the tty get colored according to priority. ๐ŸŒˆ

Heads up tho: this setting is only useful when messages are written directly to the terminal, because journalctl(1) and other tools that display logs will color messages based on the log level on their own. They got it handled. ๐Ÿ’…

  • $SYSTEMD_LOG_TIME โ€” a boolean. If true, console log messages get prefixed with a timestamp. โฐ

Same deal as above: this is only useful when messages are written directly to the terminal or a file, because journalctl(1) and other tools that display logs attach timestamps based on the entry metadata on their own. They don't need ur help.

  • $SYSTEMD_LOG_LOCATION โ€” a boolean. If true, messages get prefixed with a filename and line number in the source code where the message originates. ๐Ÿ“

Note that the log location is often attached as metadata to journal entries anyway โ€” but including it directly in the message text can nevertheless be convenient when debugging programs. Debugging era. ๐Ÿ›

  • $SYSTEMD_LOG_TID โ€” a boolean. If true, messages get prefixed with the current numerical thread ID (TID). ๐Ÿงต

Note that the this information is attached as metadata to journal entries anyway โ€” but including it directly in the message text can nevertheless be convenient when debugging programs.

  • $SYSTEMD_LOG_TARGET โ€” where the log messages go. One of console (log to the attached tty), console-prefixed (log to the attached tty but with prefixes encoding the log level and "facility", see syslog(3)), kmsg (log to the kernel circular log buffer), journal (log to the journal), journal-or-kmsg (log to the journal if available, and to kmsg otherwise), auto (determine the appropriate log target automatically, the default), or null (disable log output). Pick ur fighter. ๐ŸฅŠ
  • $SYSTEMD_LOG_RATELIMIT_KMSG โ€” whether to ratelimit kmsg or not. Takes a boolean. Defaults to "true". If disabled, systemd will not ratelimit messages written to kmsg. ๐Ÿšฆ
  • $SYSTEMD_PAGER, $PAGER โ€” which pager to use when --no-pager isn't given. $SYSTEMD_PAGER is used if it's set; otherwise $PAGER is used. If neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known pager implementations gets tried in turn โ€” including less(1) and more(1) โ€” until one is found. And if no pager implementation is discovered at all? No pager is invoked, we just vibe raw. ๐Ÿ˜Œ Setting those environment variables to an empty string or the value "cat" is equivalent to passing --no-pager.
Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER and $PAGER can only be used to disable the pager (with "cat" or ""), and are otherwise ignored. Like, straight up ignored. ๐Ÿซฅ
  • $SYSTEMD_LESS โ€” override the options passed to less (by default "FRSXMK"). ๐ŸŽ€

Users might want to change two options in particular:

K

This option instructs the pager to exit immediately when Ctrl+C is pressed. To allow less to handle Ctrl+C itself and switch back to the pager command prompt, unset this option.

If the value of $SYSTEMD_LESS does not include "K", and the pager that is invoked is less, Ctrl+C will be ignored by the executable, and needs to be handled by the pager.

X

This option instructs the pager to not send termcap initialization and deinitialization strings to the terminal. It's set by default to allow command output to remain visible in the terminal even after the pager exits. Nevertheless, this prevents some pager functionality from working โ€” in particular, paged output cannot be scrolled with the mouse. ๐Ÿ–ฑ๏ธ๐Ÿ˜ญ

Note that setting the regular $LESS environment variable has no effect for less invocations by systemd tools. Not the one, bestie.

See less(1) for more discussion.

  • $SYSTEMD_LESSCHARSET โ€” override the charset passed to less (by default "utf-8", if the invoking terminal is determined to be UTF-8 compatible). ๐Ÿ”ค

Note that setting the regular $LESSCHARSET environment variable has no effect for less invocations by systemd tools.

  • $SYSTEMD_PAGERSECURE โ€” okay this one is the serious one, so listen up. ๐Ÿšจ Common pager commands like less(1), in addition to "paging" (aka scrolling through the output), support opening of or writing to other files and running arbitrary shell commands. When commands are invoked with elevated privileges โ€” for example under sudo(8) or pkexec(1) โ€” the pager becomes a security boundary. Care must be taken that only programs with strictly limited functionality are used as pagers, and that unintended interactive features like opening or creation of new files or starting of subprocesses are not allowed. "Secure mode" for the pager may be enabled as described below, if the pager supports that (most pagers are not written in a way that takes this into consideration, which is giving ๐Ÿšฉ). It is recommended to either explicitly enable "secure mode" or to completely disable the pager using --no-pager or PAGER=cat when allowing untrusted users to execute commands with elevated privileges.

This option takes a boolean argument. When set to true, the "secure mode" of the pager is enabled. In "secure mode", LESSSECURE=1 will be set when invoking the pager, which instructs the pager to disable commands that open or create new files or start new subprocesses. Currently only less(1) is known to understand this variable and implement "secure mode".

When set to false, no limitation is placed on the pager. Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited environment may allow the user to invoke arbitrary commands. ๐Ÿ˜ฌ

When $SYSTEMD_PAGERSECURE is not set, systemd tools attempt to automatically figure out if "secure mode" should be enabled and whether the pager supports it. "Secure mode" is enabled if the effective UID is not the same as the owner of the login session, see geteuid(2) and sd_pid_get_owner_uid(3), or when running under sudo(8) or similar tools ($SUDO_UID is set [1]). In those cases, SYSTEMD_PAGERSECURE=1 will be set and pagers which are not known to implement "secure mode" will not be used at all. Note that this autodetection only covers the most common mechanisms to elevate privileges and is intended as convenience. It is recommended to explicitly set $SYSTEMD_PAGERSECURE or disable the pager.

Note that if the $SYSTEMD_PAGER or $PAGER variables are to be honoured, other than to disable the pager, $SYSTEMD_PAGERSECURE must be set too. Package deal, fr fr. ๐Ÿค

  • $SYSTEMD_COLORS โ€” takes a boolean argument, or a special value. By default (unset), systemd and related utilities will use colors in their output if possible. If $COLORTERM is set to "truecolor" or "24bit", 24-bit colors will be enabled, 256 colors otherwise โ€” unless $NO_COLOR or $TERM indicates colors are disabled. ๐ŸŽจ
    • true โ€” same as unset, except that $NO_COLOR is ignored.
    • false โ€” the output will be monochrome. ๐Ÿ–ค
    • "16", "256", "24bit" โ€” always use the base 16 ANSI colors, 256 colors, or 24 bit color, respectively.
    • "auto-16", "auto-256", "auto-24bit" โ€” use the given quantity of colours, subject to $TERM, and what the console is connected to.
  • $SYSTEMD_URLIFY โ€” the value must be a boolean. Controls whether clickable links should be generated in the output for terminal emulators supporting this. This can be specified to override the decision that systemd makes based on $TERM and other conditions. ๐Ÿ”—โœจ

๐Ÿซถ SEE ALSO ๐Ÿซถ

systemd(1), locale(7), locale.conf(5), vconsole.conf(5), loadkeys(1), kbd(4), The XKB Configuration Guide[2], systemctl(1), systemd-localed.service(8), systemd-firstboot(1)


๐Ÿ“ NOTES ๐Ÿ“

  1. It is recommended for other tools to set and check $SUDO_UID as appropriate, treating it is a common interface.
  2. The XKB Configuration Guide http://www.x.org/releases/current/doc/xorg-docs/input/XKB-Config.html

And that's the whole page bestie, u made it to the end!! ๐ŸŽ‰ This one's from systemd 262.1, and the page itself is LOCALECTL(1). Go forth and locale-configurate, icon. ๐Ÿ’–๐Ÿฆ‹๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from
  • arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms