# Ubuntu – Enable Ctrl (or Alt) + arrow keys to mimic ‘home’ and ‘end’ functionality

key-bindingkeyboard shortcutsremappingUbuntu

I am a long time Mac user and I'm now using a Ubuntu machine for development, and while I'm more or less used to a lot of the keyboard shortcuts, one thing I can't get used to is using the 'Home' and 'End' keys to move around lines of text. On a Mac you use "Command + right arrow" to go to the end of a line and "Command + left arrow" to go to the beginning.

Is there a way to enable this kind of functionality in Linux?

I'm not sure if this would be considered remapping, keyboard shortcuts, or what…

Using xmodmap (some hints) you can rebind keys for the whole window system. The following approach will deliver what you want, but with side effects :(

Try it out in a terminal window first:

1. Let the left Alt key be the so called Mode_switch:

1. Assign the key the Mode_switch key sym:

xmodmap -e 'keycode  64 = Mode_switch Meta_L Alt_L Meta_L'

2. (Normally: Make sure that Mode_switch is assigned to one of the mod1-5 modifier keys, but this is already the case in Ubuntu)

2. Modify the third row of the Left and Right keys

xmodmap -e 'keycode 113 = Left NoSymbol Home'
xmodmap -e 'keycode 114 = Right NoSymbol End'


As is the changes are kept until you log out. If you wish to keep it permanently put the following into a file ~/.Xmodmap:

keycode  64 = Mode_switch Meta_L Alt_L Meta_L
keycode 113 = Left NoSymbol Home
keycode 114 = Right NoSymbol End


However be warned that this overrides the normal function of your Alt key (accessing menu, Alt-Tab etc.) :(

I am not an expert in xmodmap & Co, though. Maybe someone else knows how to fix this. I really like Ubuntu and Linux in general, but this whole keyboard stuff is unnecessarily complicated and sorrowly broken :-<