I am trying to configure my bash ~/.inputrc to these settings
(Note: , mean the left and right arrow keys)

  • Ctrl + - should jump back a word
  • Ctrl + - should jump forward a word

Currently I have this in my ~/.inputrc and it doesn't work. Ctrl + arrow produces nothing.


I'm sure my escape sequence is wrong.
What are the correct escape sequences for the Ctrl + arrow combinations?

  • terminal: tmux inside gnome-terminal

2 Answers 2


The simplest way to find what are the codes of a key sequence is to use ctrl - v.

So, you type ctrl V and ctrl to get:


Which is a way to write ESC[1;5C or \e[1;5C.

  • wow, cool. do you know if that an intended feature of gnome-terminal, or is it something that was discovered by accident? Feb 14, 2016 at 1:35
  • Both zsh (bindkey|grep 'quoted-insert') and bash (bind -p|grep 'quoted-insert') have a key binding to output the key codes set to <c-v>.
    – kba
    Feb 14, 2016 at 1:51
  • 1
    For what it's worth, Ctrl-V performs the same function in Vim's Insert and Command modes. Feb 14, 2016 at 16:03
  • 4
    @the_velour_fog Ctrl+V meaning “insert the next character instead of interpreting it as a terminal command” dates back from the early days of Unix. It's a feature of the kernel's command line processing that's been imitated by more sophisticated input systems such as bash, zsh, vi, ... Feb 14, 2016 at 21:22
  • 1
    @kba For the record, they're not the only ones. Bash's is actually provided by the GNU Readline library it depends on, which also binds it to <c-q> to match Emacs keybind it's copying. Zsh also binds it to both <c-v> and <c-q> but only if you enable Vim mode, ironically enough. Readline is also used by other things like Python's import rlcompleter enhancement. (Sources: tiswww.case.edu/php/chet/readline/readline.html#SEC9 and man zshzle)
    – ssokolow
    Nov 2, 2019 at 7:58

Gnome-terminal (more properly VTE) imitates some version of xterm's escape sequences. How closely it does this, depends on the version of VTE.

The relevant xterm documentation is in the PC-Style Function Keys section of XTerm Control Sequences.

What you are looking for is a string like \e[1;5D (for control left-arrow), where the 5 denotes the control modifier.

In ncurses, you can see these strings using infocmp -x, as the values for kUP5, kDN5, kLFT5 and kRIT5. For example:

  • thanks for response and link to resources. This solved the problem for me! Feb 14, 2016 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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