I'd like to remap arrow keys to windows key plus ijkl. I can do this easily in Autohotkey on windows, but I'm struggling on Linux (Ubuntu lucid).

I'd really like the solution to work independently of whether I'm using a window manager or not, and to involve modifying as few files as possible; I work on a lots of different machines and am always building new ones, so would like to minimise reconfig effort.

I've tried to understand .Xmodmap, but couldn't make it work (was hard to find detailed docs on modifier keys).

(Am also considering win+hjkl, but am probably not that hardcore)

3 Answers 3


Use xev to find out the key code for the modifier key(Win key in this case).

Let it be 66.

Make a file named Xmodmap (or whatever you like) with the following content.

keycode 66 = Mode_switch
keysym j = j J Left 
keysym l = l L Right
keysym i = i I Up
keysym k = k K Down

Now load these mappings using xmodmap Xmodmap

  • This was exactly what I needed. Thanks very much.
    – Pengin
    Commented Aug 13, 2011 at 7:52
  • 3
    What if I press ctrl+mode_switch+j? It should behave as if I pressed ctrl+left, but it does not (it acts as if I pressed ctrl+j). How can I fix this?
    – rr-
    Commented Jul 6, 2015 at 5:36
  • Solution 2 here unix.stackexchange.com/a/434143/258952 was the best option for me!
    – user1728
    Commented Mar 20, 2019 at 10:25
  • Tiny bit of additional information for those who may not find it obvious. You can load the mappings in your ~/.profile file so that they are ready on login. Cheers
    – timuçin
    Commented Dec 18, 2020 at 15:36

Slight variation of @yaniv's answer mapped for VIM shortcuts

keycode 66 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down

Also you might want to have your xmodmap run on every login.


Install xbindkeys Install xbindkeys to assign meanings to keys, xmacro Install xmacro for the meaning to be like typing another key, and xbindkeys-config Install xbindkeys-config for a configuration interface to xbindkeys. There is a good explanation on the keyboard shortcuts page in the Ubuntu community documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .