localectl: command not found

The localectl command is used to view and configure the system locale and keyboard layout settings. A system’s locale determines how it will represent various culture-specific elements, the most prominent of which is the language used in the interface. However, a locale can also determine factors such as how date and time are formatted, how monetary values are formatted, and more. Keyboard layouts can be configured independently of the locale and will determine how each physical key press is interpreted by the operating system. There are many keyboards with different physical layouts, so the system needs to be configured with the correct one or else the wrong character may be entered.

Like the timedatectl command, the localectl command offers various subcommands for managing the system locale and keyboard layout.

Subcommand Used To
status Show the current locale and keyboard layout. This is the same as issuing localectl by itself.
set-locale Set the system locale to the locale provided.
list-locales List all available locales on the system.
set-keymap Set the keyboard layout to the provided layout.
list-keymaps List all available keyboard layouts on the system.

Syntax

The syntax of the localectl command is:

# localectl [options] [subcommand]

If you encounter the below error while running the localectl command:

localectl: command not found

you may install below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install systemd
Ubuntu apt-get install systemd
Arch Linux pacman -S systemd
Kali Linux apt-get install systemd
CentOS yum install systemd
Fedora dnf install systemd
Raspbian apt-get install systemd

localectl Command Examples

1. Show the current settings of the system locale and keyboard mapping:

# localectl

2. List available locales:

# localectl list-locales

3. Set a system locale variable:

# localectl set-locale LANG=en_US.UTF-8

4. List available keymaps:

# localectl list-keymaps

5. Set the system keyboard mapping for the console and X11:

# localectl set-keymap us
Related Post