Change Kali Keyboard Layout & Language (GUI or commands)
Typing command lines is challenging enough, so let’s not add keyboard layout issues to the mix. As a French sysadmin, I know firsthand that most systems start with a QWERTY US layout, which is not what I use. Using Kali Linux? Here is how to change the layout easily to match your hardware.
The “setxkbmap” command can be used to switch the keyboard layout on Kali Linux instantly. It’s faster than the GUI (if at least you can find the letters to type it). The other option is to access the system settings via the GUI, which is more convenient, as everything can be done with the mouse only.
For once, I’ll start with the command line solution, which can resolve your problem in one short command. And then the alternative via the GUI for more comfort.
Your essential Linux handbook
Want to level up your Linux skills? Here is the perfect solution to become efficient on Linux. 20% off today!
Download now
Changing Keyboard Language via Command Line
Enroll in the Complete Cyber Security Course now, and master online safety.
Learn to defeat hackers, protect privacy, and stay anonymous with over 50 hours of on-demand video.
While this is probably the fastest way to switch between two layouts that are not too different (QWERTY/AZERTY, PT/ES, etc.), the command line solution is clearly a challenge if you have no idea where each letter is. In this case, you might want to skip this part and look at the GUI option.
Quick (temporary) change
On Kali Linux, there is a command named “setxkbmap”, taking the keyboard language as a parameter, and allowing use to quickly switch the current keyboard layout to another.
Here are some typical examples with the setxkbmap command:setxkbmap us
setxkbmap fr
setxbmap es
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
You got it, the typical syntax is simply:setxbmap <lang>
In my case, if the keyboard is configured for US users by default, this command will already help a lot:
This should work in most cases, but the command can also take additional parameters to get a more specific layout, for example:setxkbmap gb -variant colemak
You can also add options like:
- caps:swap: Swap Caps Lock and Ctrl keys.
- altgr:compose: Enable AltGr key for composing special characters.
- ctrl:nocaps: Disable Caps Lock functionality.
And combine them in your command line, with:setxkbmap gb -variant colemak -option caps:swap
List all options
You can use this command to get a list of all the options available with the setxkbmap command:setxkbmap -print
Then use the country codes, variant and options according to my previous example.
Persistent change
While the “setxkbmap” command is convenient to quickly switch from one layout to another, changes are only temporary.
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
It only affects the current X session, and the system will revert to the default layout on the next reboot.
For persistence, add the command to your startup script (e.g., .bashrc).
Another solution for system-wide persistence, is to use the -persist option, like that:sudo setxbmap fr -persist
Be aware that this will affect all users, not only your session. Use this option with caution.
Enroll in the Complete Cyber Security Course now, and master online safety.
Learn to defeat hackers, protect privacy, and stay anonymous with over 50 hours of on-demand video.
Changing Keyboard Layout via GUI
But the most convenient way, especially if you have a funky layout currently enabled, is to use the GUI and add your exact layout to the system settings.
Try to type the previous command with the options on a completely wrong layout, and you’ll understand what I mean. I tried some random combinations to write this tutorial, and I can tell you, typing “setxkbmap” when no letter matches is almost impossible :-).
Anyway, here is how to change the keyboard layout via the GUI:
- Find the Keyboard settings in the main menu (under “Settings”)
- A tool shows up, click on the “Layout” tab to get access to the configuration:
- Disable “Use system defaults” option, and then you have access to everything.
- Add your keyboard layout to the list, and then remove the one you don’t want to use.
- The change is done right away, you can close the tool once you’re happy with the result
You can add as many layouts as you want, and enable the change layout shortcut if you need a way to switch to one from another.
What’s next?
Now that your keyboard layout is right, you’re ready to go a bit further with Kali Linux. Good news, you’ll find everything you need on this website. Here are some examples:
- How To Change Username & Password in Kali Linux
- Wifite: A step-by-step guide for Kali Linux users
- How to Install Nessus on Kali Linux: A quick & easy guide
Whenever you’re ready for more security, here are things you should think about:
- Break free from Gmail:
You should be able to choose what happens to your data. With Proton, only you can read your emails.
Get private email.
- Protect yourself online:
Use a high-speed Swiss VPN that safeguards your privacy. Open-source, no activity logs.
Get Proton VPN risk-free.
- Master Linux commands:
A sure method to learn (and remember) Linux commands. Useful ones only, one at a time, with clear explanations.
Download the e-book.