Change Keyboard Layout in TTY Permanently

1

How can I change the keyboard layout in the TTY aka text mode reached through the combinations Ctrl+Alt+F1 through F6 permanently?

I tried sudo echo 'KEYMAP=de' > /etc/conf.d/keymap and echo 'KEYMAP=de' > /etc/vconsole.conf without success.

Alex

Posted 2018-05-06T23:38:24.370

Reputation: 248

https://wiki.archlinux.org/index.php/Keyboard_configuration_in_console – Ignacio Vazquez-Abrams – 2018-05-06T23:42:51.023

@Ignacio Vazquez-Abrams I forgot to mention that I edited the vconsole.conf also like this echo 'KEYMAP=de' > /etc/vconsole.conf. – Alex – 2018-05-06T23:48:45.643

Never mind, I just double-checked. I had a typo KEYNAP :D. Answering the question as soon as possible. – Alex – 2018-05-06T23:53:24.717

Answers

0

echo 'KEYMAP=de' | sudo tee /etc/vconsole.conf

does the job, provided you don't make any typos. You may confirm with

cat /etc/vconsole.conf

Alex

Posted 2018-05-06T23:38:24.370

Reputation: 248

0

Your idea is correct, just the required command is off. sudo echo > whatever only executes echo with elevated privileges, the redirect is applied by the shell and so is not elevated. To write with sudo privileges, a common idiom is to pipe to tee and elevate that with sudo, so your command would become:

echo 'KEYMAP=de' | sudo tee /etc/vconsole.conf

An alternative would be to edit the file with your editor of choice launched with sudo.

If you only want to append to a file, you may use tee -a, or to modify a files contents use some other utility such as sed:

sudo sed -i 's/\(KEYMAP\).*/\1=dvorak-de/' /etc/vconsole.conf

bschlueter

Posted 2018-05-06T23:38:24.370

Reputation: 168