CentOS 7 / RHEL 7: How To Change The System Keyboard Layout
The System keyboard layout is used to control the layout used on the text console and GUI on linux system. How Do I change the system keyboard layout under centos 7 or RHEL 7 operating system? How to check the current keyboard layout settings? this post will guide you to change keyboard layour and get the current keyboard layout status on centos 7.
CentOS 7 Check The Current Keyboard Layout Settings
To check the current keyboard layout configuration, you can use the “localectl status” command, I have talked about this command in the prevous post.
CentOS 7 /RHEL 7: How To Change The System Locale
Issue the following command:
localectl status
Output:
[root@devops ~]# localectl status System Locale: LANG=de_DE.UTF-8 VC Keymap: us X11 Layout: us X11 Model: pc105+inet X11 Options: terminate:ctrl_alt_bksp
In the above output, you can see the keyboard layout settings for virtual console and X11 window system.
CentOS 7 List All Available keymaps
To set a new keyboard layout, you have to find that which keyboard layout or keymaps can be selected. using the following command to list all available keymaps.
localectl list-keymaps
Example: Find all available us keyboard layouts,
Issue the following command:
localectl list-keymaps | grep us
Outputs:
[root@devops ~]# localectl list-keymaps | grep us amiga-us atari-us br-latin1-us cz-us-qwertz is-latin1-us mac-us sunt5-cz-us sunt5-us-cz us us-acentos
CentOS 7 Changing The Keyboard Layout (keymap)
If you want to change the default keyboard layout, type the following localectl command in command line interface, type:
localectl set-keyp <map name>
you need to specify one map name which is a keymap that you want to select from the output of “localectl list-keymaps”
Example: Set the default keyboard layout to “mac-us”,type:
localectl set-keymap mac-us
Output:
[root@devops ~]# localectl status System Locale: LANG=de_DE.UTF-8 VC Keymap: mac-us X11 Layout: us
To change the default keyboard layout for X11 windows system, issue the following command:
localectl set-x11-keymap <map name>
Note:if you do not pass the option “–no-convert” for above command, the keyboard layout setting for X11 windows system will be changed and it will also convert the keyboard layout setting for VC keymap to the closest matching X11 Layout. or the VC keymap will be changed to “n/a”.
See below output:
[root@devops ~]# localectl status System Locale: LANG=de_DE.UTF-8 VC Keymap: us X11 Layout: us [root@devops ~]# localectl set-x11-keymap amiga-us [root@devops ~]# localectl status System Locale: LANG=de_DE.UTF-8 VC Keymap: n/a X11 Layout: amiga-us
So if you want to set X11 keyboard layout to differ from the console keyboard layout, issue the localectl with “–no-convert” option, type:
localectl --no-convert set-x11-keymap
Outputs:
[root@devops ~]# localectl status System Locale: LANG=de_DE.UTF-8 VC Keymap: us X11 Layout: us X11 Model: pc105+inet X11 Options: terminate:ctrl_alt_bksp [root@devops ~]# localectl --no-convert set-x11-keymap amiga-us
Then you can check the current keyboard layout status to verify that VC keymap isn’t changed.
[root@devops ~]# localectl status System Locale: LANG=de_DE.UTF-8 VC Keymap: us X11 Layout: amiga-us
Done….