Command Line – Make CTRL and Super/CMD Keys Behave Like OS X

command linemacshortcut-keys

I am a longtime OS X user who is using Ubuntu at work. While I like Ubuntu very much, something that I really miss is the behavior of the CTRL & CMD (i.e. Super) keys on OS X:

  • CMD/Super is used for most GUI shortcuts, such as copy/pasting, closing windows, …
  • CTRL is mainly used for entering control keys in the terminal, i.e. CTRL+C generates a SIGINT.

While working in a terminal I can still use the same shortcuts for copying and pasting. I find this immensely practical. On Ubuntu I have to use the mouse and the contextual menu.

Is there any way I can make these keys behave like on OS X?

Best Answer

Here's how I've done it on my MAC book running Kubuntu :

  1. Use xmodmap to swap command key and ctrl key globally.
    a) Put the following in a file ~/.Xmodmap

    clear control  
    clear mod4  
    
    keycode 105 =  
    keycode 206 =  
    
    keycode 133 = Control_L NoSymbol Control_L  
    keycode 134 = Control_R NoSymbol Control_R  
    keycode 37 = Super_L NoSymbol Super_L  
    
    add control = Control_L  
    add control = Control_R  
    add mod4 = Super_L  
    

    b) Run the following command :

    $ xmodmap ~/.Xmodmap 
    

    This will make all your application use Command + .. instead of ctrl + .. except terminal
    Remember, your command key is now ctrl key

2. Modify shortcut keys for Terminal

a) In terminal application, go to "Configure Shortcuts"
b) Change the shortcuts for the following :

  • Cut - To 'Command + c '

  • Paste - To 'Command + v '

  • Interrupt - To 'Ctrl + c '

  • New Tab - To ' Command + t'

  • Close Tab - To 'Command + w'

  • Any other key your are particular about ..

3. Disable Meta key from invoking the app launcher [ kubuntu only ]

Add the following to ~/.config/kwinrc

[ModifierOnlyShortcuts]  
Meta=