Remap keyboard keys on Ubuntu

I bought a new notebook, which is fantastic, but has a strange keyboard. In particular I have to press the Function and Page Up keys at the same time in order to be able to go to the beginning of the line, or Function and Page Down keys if I want to go to the end of the line. I am a software developer so that these keys are very important to me when I code. For several days I cursed the keyboard in several languages, including ancient Aramaic, then I decided to make a change. Ubuntu allows to remap the keyboard keys in a easy way.

First of all you should make a backup of the following file:

sudo cp /usr/share/X11/xkb/symbols/pc /usr/share/X11/xkb/symbols/pc.backup

Then you can edit and customize your keyboard as you like.

sudo nano /usr/share/X11/xkb/symbols/pc

For example, In the following text, I replaced Page Up with go to the beginning of line and Page Down with go to the end of the line. While Page Up and Page Down are accessible from the Function key.

xkb_symbols "editing" {
    key <HOME> {        [  Prior                ]       };
    key <PGUP> {        [  Home         ]       };
    key  <END> {        [  Next                 ]       };
    key <PGDN> {        [  End                  ]       };