Both my local and remote are Ubuntu 18, though I have seen it in 16 as well.

I establish a ssh to my remote server, start tmux (2.1.3), something causes the pipe to break. When I ssh back in, but before I start tmux, whenever I click in the terminal screen, it writes a bunch of junk to the buffer, like

0;38;15M 0;38;15m 0;60;12M0;60;12m0;56;14M0;56;14m0;56;14M0;56;14m0;54;13M0;54;13m0;54;13M0;54;13m

I've deduced that these numbers are of the form N;X;YM, where N is 0, 1, 2... for left click, middle, right click, X and Y are proportional to the location of the mouse click, M is mouse down, m is mouse up.

Clearly, this is some kind of in-band signalling, and I am pretty sure it relates to option mouse on. But where is it coming from? Is it just a Tmux thing, an ssh thing, or a Gnome terminal thing?

1 Answer 1


These are escape sequences that tell tmux about mouse events. Because tmux was disconnected unexpectedly it didn't get a chance to turn mouse mode off so the terminal is still sending them even though no application wants them. You can run "reset" to turn it off.

  • Cool! That reset trick was handy. So is this something in the underlying TTY spec to pick up mouse events? I imagine the terminal emulator must be picking up the mouse events and converting them to the escape codes? Jun 12, 2019 at 19:31
  • 1
    Right the terminal emulator gets mouse events from X or whatever and sends them to the application (if it requests them). Jun 12, 2019 at 20:20
  • 1
    The stuff you are seeing is SGR mouse mode, there are several others. It's in here somewhere invisible-island.net/xterm/ctlseqs/ctlseqs.html Jun 12, 2019 at 20:30
  • Ah, precisely what I was looking for! Not at all surprised X is behind this. So cool. Jun 12, 2019 at 21:01
  • 5
    run reset or tput reset Dec 14, 2019 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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