(tl;dr: long investigation. sort questions on the very end.)

I just noticed that when I press super+some letters (e.g. command+n, or windowsKey+a, etc), I get a list of my hosts file in a strange format, and a new line with two letters.

For example:

user@host $ <here i press Super+n>
::1                             localhost                       test.com
test2.com                       test3.com
user@host $sn

if i start my text editor and press the same keys, i see: @sn and nothing else.

$ hexdump x
0000000 7340 0a6e                              

which doesn't look right, since nothing would happen if that was what that key combination was sending. So it must be missing information. Let's try something else

$ cat `tty` | hexdump 
0000000 4018 6e73 000a                         

I'm going to guess the 000a is the consequence of me having to enter a new line and press ctrl+D to leave the tty and allow the redirection to hexdump to happen. So let's ignore that.

I'm left with the rest of the hex values, which would be in the correct order:

18: CAN cancel
40: @
73: s
6E: n

I couldn't find what CAN char does. it is not listed on stty -a

$ stty -a
speed 38400 baud; rows 33; columns 151; line = 0;
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; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc

There's no ^X anywhere. But it was nice of cat to show it mapped as such, otherwise i would be very lost.

Wikipedia on the cancel control character doesn't explain what is happening. But confirms the ^X mapping.

Now that we know CAN is ^X, I can type: ^X (which leaves the terminal in a weird, non-echoed state, much like START, which stty shows correct as ^Q), and then pressing @ shows the same hosts list as before!

OK, so ^X might be a feature of something besides the terminal. That leaves Bash. which led me to this answer (which ironically points to deleted information from wikipedia and is not the chosen answer). The bash manual shows ^X (with the notation C-x), is used all over the place:

C-x @ is used for possible-hostname-completions (C-x @)

It have nothing to do with Cancel Control Character, but if stty doesn't know that this char is ^X, what does the mapping? that is, if I type ^V ^X i get char 0x18.

So that whole investigation leaves me with a few questions:

  1. What is responsible for the Control+x = cancel character (ascii 0x18) mapping the terminal? why it is not listed on stty -a? But cat knows about it, how? Why I can type Cancel Char with ^V ^X?

  2. why pressing super+some letters result in ^X@s+letter? (this is the only part that only happens on KDE's konsole, all the rest works on xterm too. I do not have any special shortcut key configured anywhere) (edit: more detailed own question here)


1 Answer 1


As you say,C-x @ is used for possible-hostname-completions. If you look this up in the bash manual link you provided, it's in the section "Letting Readline Type For You".

Readline is a library that allows line editing and other things like tab completion. It's used in bash, but also in other programs.

So readline inside bash, with a particular configuration for bash, is responsible for showing the list of hosts. This has nothing to do with stty, which is part of the tty settings, in a part of unix that came long long before the readline library.

Interpretation of tty settings happens long before readline sees any of them.

cat doesn't "know" about any of this.

As for why Super together with some other keys produce this sequence: On my system it doesn't, and I have no idea why it does on your system. The first place I'd look is your terminal emulator (you didn't say which one you use, I use xterm). The second place is your desktop manager / window manager.

You must log in to answer this question.

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