# How to change keyboard mapping in the console?



## macondo (Jan 23, 2015)

In the console I get the default, US English map for my keyboard, in the X system I got the Spanish mapping which is what I installed.

How do I change the console mapping to Spanish keyboard? Thanks.

PS: I installed FreeBSD 10.1.


----------



## chrbr (Jan 23, 2015)

I think you can edit /etc/login.conf to achieve that. Please see below some part of my configuration.

```
default:\
  :charset=UTF-8:\
  :lang=de_DE.UTF-8:\
```
This has helped me with using Umlaute. Please see https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/using-localization.html for details.


----------



## macondo (Jan 23, 2015)

It didn't work 
Thank you for your prompt reply!


----------



## chrbr (Jan 23, 2015)

If it is about UTF-8 life can be more "interesting" as expected. If you use sh as shell it might not work. But applications as mutt, slrn or vim work as expected. Please try to change to csh. In my case using sh and pressing äöü or so just results in beeping. When I start vim or csh or so I can enter the Umlaute and they appear on the screen. It is possible to use some ISO8859-something, but then issues with UTF-8 coded text, for example you receive by email will pop up.

Please check the output of `locale` and please try csh and/or the console applications you like to use.


----------



## tobik@ (Jan 23, 2015)

Run `kbdmap` (see kbdmap(1))
Select your keyboard layout
This will print a line like keymap="..."
Try typing and see if it is the correct layout
Add the keymap line to /etc/rc.conf


----------



## macondo (Jan 23, 2015)

No joy 
I did what you said and went to rc.conf and the iso# was already written there, no change, this is a serious bug. At the beginning of the installation the user has 3 options for installing a spanish keyboard, none fulfills the conditions, IOW, none of the three has the "ñ" key.
Thank you for your time!


----------



## chrbr (Jan 24, 2015)

Dear macondo,
I think tobik is right. I have just tried in the console to change the keymap to "es.acc.kbd" using `kbdmap` and selecting "es.acc.kbd" out of the menu. I have tried this as root with the csh shell. When I press the key below "p" right of "l" I get the "ñ" printed on the screen, even with my UTF-8 locale setting as described some posts above. Doing this in the sh shell the key press results in beeps. But when I open vim I get the "ñ" as well. Please re-try the advise of tobik using csh.


----------



## petrek (Jan 24, 2015)

First, to have UTF-8 you need a vt console, for this you need to add
`kern.vty="vt"` to your /boot/loader.conf

Next, in your /etc/rc.conf you must have `keymap="es"`

In /etc/login.conf you need to add at least this:


```
spanish|Spanish Users Accounts:\
:charset=UTF-8:\
:lang=es_ES.UTF-8:
```

Then in terminal run: `#cap_mkdb /etc/login.conf`

And finally: `#pw user mod root -L spanish` 
if you want to add spanish letters for some other user, just change root to user login name, for example:
`#pw user mod macondo -L spanish` 
After reboot you should have Spanish signs.


----------



## macondo (Jan 24, 2015)

Thank you gents, i I'll try again soon but i I have to switch CPUs (i I got 2 towers) one with Debian and the other with FreeBSD.
Thanks again.


----------



## samob (Mar 26, 2020)

Thank you guys, with this thread I successfully enabled slovenian characters like ščžćđ. I wrote small slovenian howto for 12.1
Howto enable slovenian characters on FreeBSD 12


----------



## SirDice (Mar 26, 2020)

You don't need to set kern.vty in loader.conf, vt(4) is the default console, no need to set it explicitly.


----------

