Search code examples
macosbashterminalstty

What is the representation of the mac command key in the terminal?


Like control key is represented by a '^' in the terminal, what is the equivalent for the command key (mac)?

I am trying to remap my bash shortcuts using stty

For eg

stty eof ^D

But instead of control, I want to use the command key.

EDIT:

Okay so the issue I was trying to solve was that I wanted to interchange command and control keys because I work on osx and linux and the different key combinations cause me a lot of pain.

So I interchanged the modifier keys using osx preferences. But now all the bash shortcuts like Ctrl+C etc had become equivalent of using the key sequences 'cmd+c' - which is not acceptable.

Thankfully iTerm2, supports remapping of modifier keys as well, so for iterm2 I reversed them again which means iTerm2 recognizes command as command and control as control.

So problem solved for now.


Solution

  • The command-key shortcuts do not generate actual input for your terminal, so they are not represented in any way. Terminal allows you to bind certain key combinations to produce actual input (in Preferences > Settings > Keybaord), but you don't get the choice of a Command modifier for them.