Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is the key binding for tab to complete in the readline settings set implicitly. Because when I outputted

bind -q complete

I got this in return

complete can be invoked via "\C-i", "\e\e".

Thanks in advance :-)

Interestingly when I typed

bind -u complete

tab stopped working

share|improve this question
2  
\C-i (Control+i) represents Tab. Does that answer your question? –  rozcietrzewiacz Dec 23 '11 at 6:58
    
Yes sorry about that, didn't realize –  rubixibuc Dec 23 '11 at 7:11
    
It's OK, this isn't really intuitive. –  rozcietrzewiacz Dec 23 '11 at 7:16

1 Answer 1

up vote 1 down vote accepted

Text terminals only understand characters, not keys. So special keys like Tab, Backspace, Enter and so on have to be encoded in terms of characters. The ASCII character set, which all modern character sets are based on, reserves a space for control characters. One such character is Tab. Because it is character number 9, and I is letter number 9, pressing Ctrl+I is equivalent to pressing Tab in a text terminal.

You can see what character or character sequence a key sends by doing the following in a shell:

  1. Start typing echo -n ' at the prompt.
  2. Press Ctrl+V, which tells the shell that you really want to enter the next character and not have it treated as an edition command.
  3. Press the key (or key combination like Shift+Tab) you want information about.
  4. Enter | hexdump -C and press Return.

You'll see a printout of the byte(s) sent by the key in hexadecimal. Bytes 00 to 1f are control characters (^@, ^A to ^Z, ^[, ^\, ^], ^^ and ^_; ^x is a common notation for the control character obtained by pressing Ctrl+x).

share|improve this answer
    
how come unless i type ctrl-v tab after an escape like \ it will just print a single space? So if type \ then press Ctrl-v tab it will work but if press just Control-v tab is doesn't I though ctrl-v sort of escapes it already –  rubixibuc Dec 24 '11 at 22:24
1  
@rubixibuc Ctrl+V escapes for the part of the shell that reads from the terminal, so e.g. Tab means “insert a tab character” and not “complete”. ` and '` and " escape in the shell as a programming language, so the tab character is used literally and not as a word separator. –  Gilles Dec 26 '11 at 9:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.