Linux – How to Remap Keys in Ubuntu

linuxUbuntuxorg

I'd like to switch my Ctrl and Alt keys under Linux (to make it more Mac-like). How do I do this?

If it helps, I'm running Ubuntu 9.04.

Best Answer

First off, try looking in Preferences > Keyboard > Layouts > Layout Options under the Alt/Win key behavior if there is a suitable option there for you.

If that doesn't do it for you, these xmodmap commands would switch left Ctrl with left Alt (at least with my keyboard).

xmodmap -e 'keycode 37 = Alt_L  ISO_Prev_Group ISO_Prev_Group NoSymbol ISO_Prev_Group' 
xmodmap -e 'keycode 64 = Control_L' 

To get your keycode, you can run the program xev in a terminal window and press first Ctrl and note the keycode, then Alt to get the keycode.

Related Question