Every once in awhile, I'll accidentally blast some control codes into my terminal session (either errant coding or accidentally gpg --export). This sometimes causes my tmux session to loose it's formatting and print control characters into the borders of the tmux windows. All the tmux windows get pretty messed up after than. Even just focusing a window messes up the other windows. The traditional reset tricks for a terminal (reset, echo [CTRL]+V [CTRL]+C) don't fix it so I end up logging out of all active sessions and having to restart tmux.

Anyone know of a way to reset/refresh all the tmux panes without terminating tmux ?

4 Answers 4


There is a detailed explication how to reset many parts of tmux in stack exchange: https://unix.stackexchange.com/questions/49886/tmux-status-bar-corrupted-after-catting-a-binary-file-how-to-reset

For me, often only tmux rename-window myWindowName and printf '\033]2;%s\007' "$(uname -n) (set status right) are required.

  • 1
    Thanks, this works! stty sane; printf '\033k%s\033\\\033]2;%s\007' "basename "$SHELL"" "uname -n"; tput reset; tmux refresh Jan 17, 2019 at 19:15

Ctrl+B then r should do it. This causes tmux to redraw the entire screen from scratch.

  • Good idea, but no luck. Nov 30, 2018 at 19:44
  • Huh. You know, I can't even get my GNOME terminal with tmux to go haywire like that anymore, not even by deliberately catting binary files to it. Maybe it's time for some upgrades? Nov 30, 2018 at 19:46
  • Hrm.. I am using xfce4-terminal. Maybe that's the problem. If you don't mind, try gpg --export. That usually does it. Nov 30, 2018 at 19:59
  • Tried gpg --export. GNOME terminal 3.30 just laughs it off, in or out of tmux. Nov 30, 2018 at 20:01
  • Likely something with my setup or tmux verson. I'm running Ubuntu 16.04 and this happens with xterm, LXterminal and xfce4-terminal. I'll see if I can root it out. Thanks for your time. Nov 30, 2018 at 20:06

3 options...

  1. stty sane
  2. reset
  3. echo ^v^o (that's E

ctrl-b r is not the right answer. The right answer is:

  1. ctrl-b shift-D to get a list of the attached sessions
  2. select the session that you were using when you messed up the screen, and press Enter to detach it (or iterate through this list and detach from all sessions, if you prefer)
  3. if detached from all sessions in #2, then tmux attach -t again to attach a brand new session. This will get rid of the problematic session without having to terminate tmux.
  • Can't seem to get this to work either. When I tmux attach -t 0 the session is still corrupt from the gpg --export output Jan 17, 2019 at 19:12

You must log in to answer this question.

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