Recently I've been reviewing the bash shortcuts keys, and trying to find an appropriate one for my tmux activate key.

I find it interesting that ctrl + m and ctrl + q are not used in bash shortcuts, according to https://en.wikipedia.org/wiki/Bash_(Unix_shell).

Why they are not used? I feel ctrl + m is quite handy.

Are these two combinations intended by design for DIY (define it yourself) usage? Or there is another story?

  • 1
    Using ALT + m is even more convenient imho.
    – Rolf
    Jul 20, 2015 at 6:44

1 Answer 1


Ctrl+M sends the same character(RET) as the Enter key in terminal. Programs have no way to tell them apart, so these keys cannot be configured separately.

Ctrl+Q is already used for XON by default, so it cannot be used by Bash, but you should still be able to use it in tmux, because tmux uses raw input mode.

A GUI program could read from the keyboard, that Key m has been pressed with modifier Ctrl and use Ctrl+m as a shortcut, but a shell or any terminal program recieves the Ctrl+Key combinations just as ascii characters from 0 to 26

Ctrl+@ = 0
Ctrl+A = 1
Ctrl+B = 2

and so on. You can try this to see the values

cat ctrlkeys <<EOF
od -c ctrlkeys
0000000 001 002 003 004 005 006  \n

To enter the values press Ctrl+v before Ctrl+[a-f] to get them uninterpreted as a raw value.

When you look at the ascii(7) table you can see the control codes in a table with the corresponding characters @..Z on the left. For example

015   13    0D    CR  '\r' (carriage ret)     115   77    4D    M


011   9     09    HT  '\t' (horizontal tab)   111   73    49    I

The next layer that interprets control codes before bash is stty (change and print the terminal settings)

stty -a
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;

see stty(1) for the meanings of lnext or start and stop.

Also see readline(3) as bash and other GNU cli programs use that library to control input lines and of course bash(1) /READLINE, the readline section of the bash manual page.

Note: XYZ(NUM) means manual page XYZ from section NUM, so the result of man NUM XYZ.

  • 1
    Bash has a default binding for C-s (XOFF), so they could have put one for C-q as well. Jul 4, 2015 at 12:18
  • Actually, by default, the GNU Readline library that Bash uses binds C-q to the same thing as C-v, a clone of the Emacs function quoted-insert which is useful for figuring out the escape codes generated by keys and key combos. Here's the relevant part of the Readline manual: tiswww.case.edu/php/chet/readline/readline.html#SEC9
    – ssokolow
    Nov 2, 2019 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .