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 am on Ubuntu and using a Microsoft keyboard. I want to map my Win key to a Ctrl key. How can I do that?

share|improve this question
up vote 10 down vote accepted

xmodmap lets you modify keymaps. Make a file to hold xmodmap commands (~/.xmodmaprc is a common choice). The Win keys are called "Super" in xmodmap (Super_L and Super_R for the left and right ones). By default they're connected to mod4, so you want to remove them from that modifier and add them to control. Add this to the command file:

remove mod4 = Super_L Super_R
add control = Super_L Super_R

Tell xmodmap to load it with:

$ xmodmap ~/.xmodmaprc

It will only last as long as your X session does, so you'll need to rerun it each time, or put it in something like ~/.xinitrc so it will be run automatically

share|improve this answer
jinx:819 Z$ grep ctrl /usr/share/X11/xkb/rules/evdev.lst | grep win
  altwin:ctrl_win      Control is mapped to Win keys (and the usual Ctrl keys)
  altwin:ctrl_alt_win  Control is mapped to Alt keys, Alt is mapped to Win keys

Go into the keyboard settings, click "Options", expand "Alt/Win key behavior", and select "Control is mapped to Win keys".

(Command line version: setxkbmap -options altwin:ctrl_win, then edit /etc/X11/xorg.conf and add XkbOptions "altwin:ctrl_win" to the keyboard InputDevice section. (If there is already an XkbOptions line, then add it to that line, separated by a comma: XkbOptions "grp:alt_shift_toggle,altwin:ctrl_win".)

share|improve this answer
Oh, that's somewhat simpler than my answer. Nice – Michael Mrozek Mar 11 '11 at 19:36
/usr/bin/setxkbmap von debian x11-xkb-utils-7.7+2 have the "-option" clause without the "s" as in "-options". – soubunmei May 20 '15 at 0:01
and debian since long years ago have unified console and x11 keyboard configurations in "/etc/default/keyboard". this file have x11 syntax, and is sourced by xserverrc, while translated for setupcon in an initscript. – soubunmei May 20 '15 at 0:06

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.