First, look at the bold part of my EDIT at the bottom! I think the original way I posed the question is confusing people.

I've followed the instructions here to switch my Alt and Ctrl keys. Now when in a terminal I want to press the physical Ctrl+C to cancel. But the new mapping means I physically press Alt+C.

I looked at the keyboard shortcuts for the terminal: enter image description here

and can't find that shortcut there.

I am on Ubuntu 20


I realised I might be confusing the problem by telling you I originally switched my Alt and Ctrl keys. You can mostly forget about that if it makes it easier. Think of the question as: "Instead of pressing ctrl+key in the terminal for things like process interruption (ctrl+C) or reverse search (ctrl+R) I want to press alt+key. How can I set that up without actually changing the system-wide key bindings in general?"


Finally, if it helps to understand my motivation for wanting to do this: right now, under my key mapping I have to physically press Shift+Alt+C to copy from the terminal, whereas in every other app that I use I just press Alt+C. After months I still can't get the hang of mentally adjusting. I end up pressing Shift in my other apps, or cancelling things in my terminal by forgetting to press Shift in the terminal. It's driving me insane!

Another point on my motivation. I'm coming from being a mac user, where in the terminal you have to press physical Ctrl+C to cancel, and physical Cmd+C to copy. On a standard non-mac keyboard, the Cmd is in the same place as the Alt. That's why I've done my key mapping this way.

  • @AlexanderSoare the edit actually confused me more... I took it as you summing up a new more generic question... So, you want to still have the functions swapped... but you want to make new shortcuts based on those swapped functions? is that right?
    – WU-TANG
    Nov 10, 2020 at 0:26
  • @WU-TANG "Instead of pressing ctrl+key in the terminal for things like process interruption (ctrl+C) or reverse search (ctrl+R) I want to press alt+key. How can I set that up without actually changing the system-wide key bindings in general?" - If you look at this in isolation and forget everything else does it help? Nov 10, 2020 at 15:37
  • You can't assign interrupt signal to Alt-C because Alt-C generates two characters, while Ctrl-C only one. But the other Readline bindings (e.g., history search) can be reassigned. If you find that acceptable, I can write an answer.
    – Quasímodo
    Nov 13, 2020 at 23:45

1 Answer 1


'How to swap alt-ctrl in the terminal?'

OS X has a handy feature that allows Command as Ctrl.
Basically Ctrl and C like key nodes can be understood by the terminal but Super can't be the same.
See https://superuser.com/questions/1178542/super-key-notation-for-stty

  • You can edit stty -a for example stty intr ^K now Control+K is an interrupt key and you lose ^K used to erase towards the end of line. But you can't do it any other mod keys Alt Esc.

  • In the other words, it is very risky to change the default key bind, for example, someone tries to replace ^M works as other things than "Return" and you can't execute any commands.

  • You can change other shortcuts in Terminal, they are shown in the shortcut menu on your question.

  • I recommend leave the principals (^C or ^R) untouched and change all other things.

Swap Ctrl and Alt systemside.

First reassign the Ctrl and Alt as you describe, using xmodkey or Gnome-Tweak Typing setting


I believe you already did this. Many other ways introduced
setxkbmap -layout 'us,us' -option 'ctrl:swap_lalt_lctl'

Using Alt key like the mac command (⌘) key for copy/paste

Swap physical keyboard layout

Now then, your Alt_L key is working as your Ctrl_L, and vice-versa.
Some keyboards are not allowed to replace keycaps, e.g. HHKB Pro cannot be done due to the different unit size.
However, most of keycaps are physically swap-able.



  • Indeed I have swapped systemwide. But I don't want that to muddy the actual question. I just want the terminal alone to read alt+C as an interrupt signal, or alt+R as reverse search, or alt+key as whatever. Nov 10, 2020 at 15:40
  • As for the first part of your answer, I'm a bit confused on whether or not that's for linux or mac, and whether you're saying it won't work, and if your warning me not do it. Nov 10, 2020 at 15:41
  • That's a good question, I don't answer it directly but yes, you can do whatever you want. The control key doesn't have another name, Alt key is Option key which was Alternate key, Win and Apple are Super/Meta key. Those were not found on the original Teletype keyboard and the computer engineers built the first Unix-Multics machine from this kind of keyboard. I don't know whether you want a key in a certain place or you like the name of ALT. See the answer, ALT or SUPER won't always work. Nov 10, 2020 at 22:39
  • Thanks. So why do recommend leaving ^C and ^R untouched. Those are the ones I use the most, and so they are the ones I most want changed! By the way, perhaps it might make sense to remove the second part (swap ctrl and alt systemwide) and the third part (swap physical keys) as they aren't actually addressing my question and are probably covered elswhere in the forums. Nov 12, 2020 at 13:46
  • sudo pip3 install xkeysnail github.com/mooz/xkeysnail Don't complain me anything about this site. Nov 12, 2020 at 18:37

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.