If a key is broken or you need to change the functionality of certain key, keyboard remapping is necessary.
You may want to remap your keyboard for various reasons including comfort and convenience. Remapping keyboard keys in Linux can be performed by following two methods.
More often than not it is already installed as part of the xserver environment. Invariably, you will want to move a key that you use regularly and is in an irritating position (eg CTRL, ALT or Page Up/Down) to a key in a better position.The keys that you want to move, of course, will be entirely dependent on the keyboard that you use. To remap keys on Linux you will need the utility xmodmap to be installed.

You can tweak the keys to function differently with following command.

For example, if your Enter key is not working, you can remap shift key to enter key and use it as your enter key… You can either buy a new keyboard or you can remap your existing keyboard. It will show you how you can swap one keyboard key with another in Linux. mremap() expands (or shrinks) an existing memory mapping, potentially moving it at the same time (controlled by the flags argument and the available virtual address space).. old_address is the old address of the virtual memory block that you want to expand (or shrink). If you also want to save some bucks and want to go ahead with the second option, then here is how to remap keyboard in Windows 10, 8, 7, and Vista. Note that old_address has to be page aligned.old_size is the old size of the virtual memory block. Either ways, you have only two options. To me, buying a new keyboard just because of one broken key doesn’t make sense.