NetBSD non-us keyboard configuration
Tags: configuration, netbsd, keyboard
Published: 2022-03-09 03:54:33

# Summary

In this part i'm going to configure my non-us keyboard by changing or adding some system configuration files for keyboard. **US** keyboard users can skip this part.

This part requires you to know basic usage of **vi** program. If you don't know how to use **vi** or **vim** check this website first: [NetBSD vi tutorial](https://www.netbsd.org/docs/guide/en/chap-edit.html#chap-edit-vi-tut)

**vi** is almost always pre-installed in every operating system. Learning **vi** is never a bad idea.

**vi** basic usage cheatsheet:

|Command|     Meaning     |
|-------|-----------------|
|h      |move cursor left |
|j      |move cursor down |
|k      |move cursor up   |
|l      |move cursor right|
|a      |add after char   |
|i      |add before char  |
|A      |add end of line  |
|I      |add start of line|
|o      |add below line   |
|O      |add above line   |
|dd     |delete one line  |
|x      |delete one char  |
|:w     |save             |
|:q     |quit             |
|:wq    |save and quit    |
|:w!    |force save       |
|:q!    |force quit       |


----------------------------

# Instructions

1- Start your system and login.

![netbsd-keyboard-001](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j6u479ahgdawlqdodcke.png)

2- Changing the system configuration requires privilege. So switch to **`root`** user with **`su`** command.

![netbsd-keyboard-002](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3uhhtzm0skd6i8bpnwld.png)

3- Open **`wscons.conf`** file with **`vi`** editor. 

![netbsd-keyboard-003](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o9q6mt2soldhsljup750.png)

4- I'm using **`tr`** keyboard. So im going to add **`encoding tr`** configuration in this file.

![netbsd-keyboard-004](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1e0reaixdt7l63hhqlch.png)

5- I'm also going to edit keymaps because my current keyboard doesn't have a less, greater key. (These characters: "<>|"). This requires me to go to **`/usr/share/wscons/keymaps/`** folder. And create a new file named **`overlay.tr`** with **`vi`** editor. (You can use anything as file name but do not forget it. We're gonna need it)

![netbsd-keyboard-005](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/331ewiu3m5b7aqyic4oa.png)

6- What i'm going to do in this file that i'm going to set some unusable turkish character buttons to bar '|' less '<' and greater '>' characters. For example there is a 'ş' character in my keyboard. It's unusable in console but i might need '|' character so i've added **`keycode 39 = bar`** line in this file to set 'ş' button to bar '|' character. I've also set 'ö' and 'ç' buttons to use less '<' and greater '>'. (You can check your full keymap with this command: **`wsconsctl map | less`**)

![netbsd-keyboard-006](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kk7ey32y9virc5273klz.png)

7- Again, open your **`wscons.conf`** file with **`vi`** editor. 

![netbsd-keyboard-003](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95o1qff4mwfxbi62gq91.png)

8- Add **`mapfile /usr/share/wscons/keymaps/overlay.tr`** configuration and save it.

![netbsd-keyboard-007](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qg4g1m959vi0r53clvwh.png)

9- Restart the system with **`shutdown -r now`** to load these new keyboard configurations.

![netbsd-keyboard-008](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/npon391qtpawdpog9z4p.png)

![netbsd-keyboard-009](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u5ehem9tdl2ipm9va00h.png)

10- When system starts, login with user and try your configured buttons. If you can see your characters it means that your keyboard configurations are working.

![netbsd-keyboard-010](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ycjdgepx4rpr8m3uo0ai.png)

Next part: Internet connection configuration.