Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 663
freethinker Avatar asked Oct 10 '12 20:10

freethinker


2 Answers

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.

like image 65
lanzz Avatar answered Sep 29 '22 12:09

lanzz


Type this in your bash shell :

stty ctlecho

then hit Command

That will display what you need.

To go back to normal

stty -ctlecho

If it doesn't work, try a combo.

Example with Ctrl+C

$ stty ctlecho
$ ^C
$ stty -ctlecho
$ 
like image 20
Gilles Quenot Avatar answered Sep 29 '22 11:09

Gilles Quenot