I am connecting from a windows machine to a remote machine using MobaXterm, and attach to a tmux session. Some key are not getting sent correctly, for example prefix + arrow keys just prints {A,B,C,D} when I press prefix+{up,down,right,left}, when these keys should navigate between tmux panes. If I use Putty (instead of MobaXterm), I can fix this by using 'linux' terminal instead of 'xterm', but in MobaXterm the terminal types I can choose are xterm, xterm-r6, vt100, vt220, and vt900. None of them work.

I guess some of the problem is the remote machine itself (which runs Ubuntu 16.04), because other remote machines do not have this problem.

Any suggestions?

  • Which remote machines work? Your question is a variant of this. Jul 6, 2016 at 8:45
  • The remote machine that works runs Red Hat 6.7. I've tried the suggestion in the question you linked to - but it doesn't work. Jul 6, 2016 at 9:19
  • There's not enough information in your question to pinpoint the problem (I'm short of time, can look more this evening). The "xterm" description on both should be the same (your TERM variable may differ, there may be tmux conf-file differences, etc). Jul 6, 2016 at 9:27
  • I'd appreciate any further suggestions. The TERM var is the same ('screen-256color' as defined the .tmux.conf file), and I use the same .tmux.conf file. Jul 6, 2016 at 9:51

2 Answers 2


There are unrelated differences between Red Hat 6 and Ubuntu 16 for the screen-256color entry: the latter adds dim and omits initc. Neither of those changes is related to cursor-keys.

Presumably the value of TERM outside tmux is xterm. There are also unrelated changes between the two systems for the xterm entry (the cursor color extensions mentioned in the terminal database).

However, there is a significant difference between the linux and xterm entries: the xterm entries (in both cases) initialize the terminal to use application mode for cursor- and keypad-keys, while that for linux does not. Application mode sends different character sequences for the cursor-keys (which is the point of this question).

Red Hat 6 has tmux 1.6, Ubuntu 16 has tmux 2.3. In either case, tmux reads the terminal description and tries to match the escape sequences sent by your outside terminal's cursor- and function-keys, and stores its notion of those keys (as a keycode and shift/control information) before generating an equivalent escape sequence which follows the terminal description inside tmux.

If your .tmux.conf file had conflicting settings as shown in Ctrl + arrow keys working in tmux, then the rather old and rather new tmux programs will differ for modified cursor-keys:

  • in CentOS6, shifted uparrow gives ^[[A^[[1;2A, while Ubuntu shows ^[[A.
  • control-uparrow also differs.

The reason for the difference is (actually) an improvement in tmux, to read the extended key definitions from the terminal database. In the older version, tmux did not notice that the xterm-style keys were not defined in the screen-256color terminal description. So it passed the information on. In the newer version, tmux sees that they are not defined, and (because it was told to be aware of xterm-keys), uses only those that are defined in the specified terminal description.

Further reading:

  • The TERM value outside tmux is indeed xterm. Regarding version, on the Red Hat system I use a locally compiled version 2.2 (since I don't have root on this system), on the Ubuntu a version I installed with apt-get, which is 2.1 Jul 10, 2016 at 6:58

It could be a conflicting prefix key, so you could try changing this. Tmux allows for this, and you can make it persist by creating a ~/.tmux.conf file.

The line to add to the conf file would be something like this:

set-option -g prefix M-a

Which would change your prefix key to Alt + A

If you don't want these changes to persist, you can just run that line as a command from within tmux.

Here's a little about the correct syntax for this (taken from the man page):

    tmux allows a command to be bound to most keys, with or without a prefix key.  When specifying keys, most represent them-
     selves (for example ‘A’ to ‘Z’).  Ctrl keys may be prefixed with ‘C-’ or ‘^’, and Alt (meta) with ‘M-’.  In addition, the
     following special key names are accepted: Up, Down, Left, Right, BSpace, BTab, DC (Delete), End, Enter, Escape, F1 to F12,
     Home, IC (Insert), NPage/PageDown/PgDn, PPage/PageUp/PgUp, Space, and Tab.  Note that to bind the ‘"’ or ‘'’ keys, quotation
     marks are necessary, for example:
  • Thanks. I tried this but with no success. I need to mention that prefix + {h,j,k,l} for selecting pane works as it should. It is the arrow keys which do not work. Actually I noticed it sometimes work, sometimes just prints A, and sometimes prints [A (or B or C or D, depending on the arrow key used) Jul 10, 2016 at 6:53

You must log in to answer this question.

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