By default the keyboard layout in FreeBSD is set to match the English keyboard. To change that, there are several possibilities to adjust the current keyboard layout.
You can simply change it graphically on the terminal with the following command:
kdbmap
After pressing Enter
you will get a graphical menu where you can choose your keyboard layout.
Like mentioned this is only a temporary change. If you reboot, the change is gone again.
Another possibility to change the keyboard layout is to use the kbdcontrol
command. To know what keyboard layouts are available do the following:
cd /usr/share/syscons/keymaps
ls
You will see something like this:
be.iso.acc.kbd finnish.cp850.kbd kk.pt154.kst.kbd swissfrench.iso.kbd
be.iso.kbd finnish.iso.kbd latinamerican.iso.acc.kbd swissgerman.cp850.kbd
bg.bds.ctrlcaps.kbd fr_CA.iso.acc.kbd latinamerican.kbd swissgerman.iso.acc.kbd
bg.phonetic.ctrlcaps.kbd fr.dvorak.acc.kbd lt.iso4.kbd swissgerman.iso.kbd
br275.cp850.kbd fr.dvorak.kbd norwegian.dvorak.kbd swissgerman.macbook.acc.kbd
br275.iso.acc.kbd fr.iso.acc.kbd norwegian.iso.kbd tr.iso9.q.kbd
br275.iso.kbd fr.iso.kbd pl_PL.dvorak.kbd ua.iso5.kbd
by.cp1131.kbd fr.macbook.acc.kbd pl_PL.ISO8859-2.kbd ua.koi8-u.kbd
by.cp1251.kbd german.cp850.kbd pt.iso.acc.kbd ua.koi8-u.shift.alt.kbd
by.iso5.kbd german.iso.acc.kbd pt.iso.kbd uk.cp850-ctrl.kbd
ce.iso2.kbd german.iso.kbd ru.cp866.kbd uk.cp850.kbd
colemak-dh.iso15.acc.kbd gr.elot.acc.kbd ru.iso5.kbd uk.dvorak.kbd
colemak.iso15.acc.kbd gr.us101.acc.kbd ru.koi8-r.kbd uk.iso-ctrl.kbd
cs.latin2.qwertz.kbd hr.iso.kbd ru.koi8-r.shift.kbd uk.iso.kbd
cz.iso2.kbd hu.iso2.101keys.kbd ru.koi8-r.win.kbd us.dvorak.kbd
danish.cp865.kbd hu.iso2.102keys.kbd si.iso.kbd us.dvorakl.kbd
danish.iso.acc.kbd hy.armscii-8.kbd sk.iso2.kbd us.dvorakp.kbd
danish.iso.kbd icelandic.iso.acc.kbd spanish.dvorak.kbd us.dvorakr.kbd
danish.iso.macbook.kbd icelandic.iso.kbd spanish.iso.acc.kbd us.dvorakx.kbd
dutch.iso.acc.kbd INDEX.keymaps spanish.iso.kbd us.emacs.kbd
eee_nordic.kbd it.iso.kbd spanish.iso15.acc.kbd us.iso.acc.kbd
el.iso07.kbd iw.iso8.kbd swedish.cp850.kbd us.iso.kbd
estonian.cp850.kbd jp.106.kbd swedish.iso.kbd us.iso.macbook.kbd
estonian.iso.kbd jp.106x.kbd swissfrench.cp850.kbd us.pc-ctrl.kbd
estonian.iso15.kbd kk.pt154.io.kbd swissfrench.iso.acc.kbd us.unix.kbd</code></pre></div>
Now you can choose which keyboad layout you would like to use. To use the german keyboad layout you have to type:
kbdcontrol -l german.iso.kbd
Like the first solution this is a temporary change, too.
To make the change permanent you can use the following.
To make the keyboard layout permanent and do not reset to the default value after a reboot you have to edit the /etc/rc.conf
. For editing the file you can use your preferred editor. In this example I use vim.
Open the file as root:
vim /etc/rc.conf
Now type i
to switch to “insert” mode.
Now check if there is already a config setting for keymap
. If it is there you can change it to your preferred layout. To get the available layout you can do the same like above in the kbdcontrol section. All available layouts are listed in the /usr/share/syscons/keymaps
directory. If you use a newer FreeBSD you can simply use de.kbd
for example instead of german.iso.kbd
.
So just insert into your /etc/rc.conf
:
keymap="de.kbd"
To save and exit the editor just press ESC
and then type :wq
.
After a reboot your configured keyboard layout should be used.