When starting a session to, in my case at least, debian and Ubuntu machines with Putty from a Windows machine, alt-left/right works as moving per word on the command-line. (Often this is also achieved on Linux systems with ctr-left/right).

However, once I started using Byobu, and set Byobu to start automatically (using the F9 menu), the alt-left/right doesn't work anymore. Instead when outputting the raw characters using Ctrl-V it shows,


-- when sending alt-right. Whereas, when byobu is not started automatically when logging in, but is started manually once logged in, I deduced that it sends,


Which is caught by a default inputrc config, and consequently it is translated to move by word.

What mechanism between Putty, the host/terminal/byobu is in play, to make make this difference in received commands?

1 Answer 1


byobu is just a wrapper around tmux, which is responsible for the behavior you're seeing. tmux is attempting to translate "keys" into the character sequence that xterm would encode modified special keys. In the manual, that's documented:

         xterm-keys [on | off]
                 If this option is set, tmux will generate xterm(1) -style
                 function key sequences; these have a number included to
                 indicate modifiers such as Shift, Alt or Ctrl.  The
                 default is off.

though in new/recent versions, reportedly the default is on. That exposed a problem, seen in this commit-message:

commit d52f579fd5e7fd21d7dcf837780cbf98498b10ce
Author: nicm <nicm>
Date:   Sun May 7 21:25:59 2017 +0000

    Up to now, tmux sees \033\033[OA as M-Up and since we turned on
    xterm-keys by default, generates \033[1;3A instead of
    \033\033[OA. Unfortunately this confuses vi, which doesn't understand
    xterm keys and now sees Escape+Up pressed within escape-time as Escape
    followed by A.

    The issue doesn't happen in xterm itself because it gets the keys from X
    and can distinguish between a genuine M-Up and Escape+Up.

    Because xterm can, tmux can too: xterm will give us \033[1;3A (that is,
    kUP3) for a real M-Up and \033\033OA for Escape+Up - in fact, we can be
    sure any \033 preceding an xterm key is a real Escape key press because
    Meta would be part of the xterm key instead of a separate \033.

    So change tmux to recognise both sequences as M-Up for its own purposes,
    but generate the xterm version of M-Up only if it originally received
    the xterm version from the terminal.

    This means we will return to sending \033\033OA instead of the xterm key
    for terminals that do not support xterm keys themselves, but there is no
    practical way around this because they do not allow us to distinguish
    between Escape+Up and M-Up. xterm style escape sequences are now the de
    facto standard for these keys in any case.

    Problem reported by jsing@ and subsequently by Cecile Tonglet in GitHub
    issue 907.
  • Thanks to your hint about xterm-keys I had something to grep on. And behold in /usr/share/byobu/profiles/tmux there it was, it set the 'xterm-keys'. Though suddenly I can't reproduce the issue conditioned on whether byobu started automatically or not.
    – hbogert
    Jun 11, 2017 at 22:33

You must log in to answer this question.

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