Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I really don't understand bash's use of control characters. I understand simple things like adding colors with escape sequences but am at a loss for how to do things like bind keys in .inputrc.

For example, is there a way to type things like Shifta and see how I should represent it in .inputrc?

Much like the fellow does here: http://linuxart.com/log/archives/2005/10/13/super-useful-inputrc

share|improve this question

For reference, here's archive.org's copy of the (dead) link in OP's question. The codes shown therein are emacs lisp style codes. I don't know much about them. Of course, there's more than one way to skin a cat, but what follows is probably the easiest:

First, use showkey -a to get the hexadecimal representation for your keyboard sequence. For example, when I press CtrlShift~, I get:

^^       30 0036 0x1e

So, my hex representation is 0x1e. I can then add a line to my ~/.inputrc:

"\x1e": beginning-of-line

And the next time I open a bash shell (or any program that uses readline), typing CtrlShift~ will move my cursor to the beginning of the line. You can also do something like:

"\x1b\x5a": "type this text whenever I press alt+shift+z"
share|improve this answer

Your Answer


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.