Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've already checked the option section in /usr/share/X11/xkb/rules/base.lst but I didn't find an entry for AltGr...

share|improve this question
up vote 4 down vote accepted

Thanks to the suggestions of the Xorg community I found out the correct setxkbmap command:

setxkbmap -option ctrl:ralt_rctrl
share|improve this answer

Surely, you can achieve this by editing the xkb rules set but it might be more convenient to use xmodmap.

You can use xev to lookup the keycode of your AltGr key. On my system it also has the name ISO_Level3_Shift which is already used for the modifier mod5 (use xmodmap to see the modifier maps). Removing it from mod5 and adding it to the control modifier makes the AltGr key work like the Ctrl: xmodmap -e "remove mod5 = ISO_Level3_Shift"; xmodmap -e "c add control = ISO_Level3_Shift".

share|improve this answer
Thanks for your help. However the reason I asked for setxkbmap is because some xmodmap entries on my /.xsesssionrc seem to be ignored at system startup, and they don't take effect. How can I edit the xkb rules to achieve the same effect? Thanks again. – mt22 Feb 25 '12 at 9:00
Anyway thanks antje-m. I'm going to +1 your answer when I'll get 15+ rep! – mt22 Feb 26 '12 at 18:08
Thank you. You mentioned that some xmodmap in .xsessionrc get ignored. Have you considered that your desktop environment might set some keyboard options that override yours? I know you didn't ask, but the thought just crossed my mind. – antje-m Feb 29 '12 at 2:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.