How I can switch the left command key on the keyboard of my macbook, with the left ctrl key?

and if it is possible that the command right, continue acting like the super key / windows


Try this:

cat > ~/.xmodmaprc
! Erase existing bindings
clear Control
clear Mod4
! Map key 37 (left ctrl) to Super_L (i.e. 'cmd')
keycode  37 = Super_L
! Map key 133 (left cmd) to Control_L (i.e. 'ctrl)
keycode 133 = Control_L
! And update modifier settings
add control = Control_L
add mod4    = Super_L

To end the input, press Ctrl+D.

To test you can run:

xmodmap ~/.xmodmaprc

Finally, you should add this command to startup applications.

This should get you started. If this does not quite work for you, checkout this for more info:

man xmodmap

To watch which key press corresponds to which internal keycode, run


and press some keys when the little white window has the focus. The keycodes won't change (133 will always be 133, but you should see the name of 133 before as Control_L and after this procedure, after you log in again, it should be Super_L.

  • cheers, using a mac keyboard has never been so confusing until this swap. Sep 14 '12 at 13:10
  • Note: the code for right command key is 134. I added keycode 134 = Control_L and it works for me.
    – Elazar
    Jul 4 '18 at 5:39

A quick way to do this would be to goto System -> Preferences -> Keyboard -> Layouts tab -> Options -> Alt/Win key behavior -> select Win key as control


But of course there is no Win key on a Mac.

  • 2
    This option doesn't seem to exists in Unbuntu 13.10, did they remove it? Mar 8 '14 at 17:24

For anyone using KDE, check under System Settings > Input Devices > Keyboard > Advanced. You'll need to enable "Configure keyboard options", open up "Alt/Win key behavior", then check "Ctrl is mapped to Win keys (and the usual Ctrl keys)". There is an identical setting for Alt mapping to the Win keys if you'd prefer the Control key be Alt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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