Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I accidentally screw up my tmux terminal after cating a binary file. Now my tmux is messed up. Detaching and re-attaching doesn't help, nor does a redraw (C-b r). Running reset only redraws the active pane, not the rest. Running ssty sane either in- or outside tmux doesn't help either.

tmux messed up

Within each pane, I have normal feedback from what I type (the initial call of reset immediately after the terminal got messed up solved this), but I can't seem to fix the status-bar.

In gnome-terminal, every update to the status-bar leads to the status-bar to grow (see screenshot above). For example, this happens when I run a new application, when I switch panes, or when I resize a pane. Forcing a redraw (By C-b r, by running reset or via the gnome-terminal menu) shrinks back the status-bar to a single line, but it remains corrupted.

In xterm, the status-bar does remain within one line, but it remains corrupted as pictured.

I'm using tmux 1.5.

  • How do I fix my tmux-terminal?

This bug report from 2008 seems to describe the same issue, but it was marked as fixed. I don't know in what version it was fixed, but tmux 1.5 ought to include a fix from 2008.

share|improve this question
Just had this problem, and "clear" worked for me. – user149818 Dec 2 '14 at 16:05
In case somebody runs into the same problem, after doing all of the above, my tmux status bar was still messed up. Setting the window option status-right repaired it. – user96241 Dec 28 '14 at 14:15
The above suggestion fixed it for me too. The command to do that was: Control + b + : and then set -g status-right "#H" to set status-right to the hostname. – Mayank Jul 21 at 0:45
up vote 34 down vote accepted

Try renaming window 4

  • Switch to window 4: Control+b 4
  • Rename window: Control+b , Control+u myNewname

(Thats a comma in the middle)

Or: Control+b :rename-window myNewname

share|improve this answer
Renaming the window works like a charm – exhuma Mar 31 '15 at 8:30
You need to clear the name before typing the new one. The easiest way is with ctrl+u, so the full sequence is ctrl+b , ctrl+u newname – z0r May 22 '15 at 4:46
Sweet - this works for byobu as well (f8, <newname>) – ali_m Nov 18 '15 at 16:55

The specific problem you are seeing has to do with the name/title of window 4. A combination of being too long (obviously) and containing strange characters which cause tmux to measure it as being shorter (so it fails to properly limit the status bar to the width of the screen) I am not sure how to reset it (on mine it tracks the name of the foreground process), you may have to close the window.

share|improve this answer
default to rename a window is ^b - , – Rob Dec 6 '12 at 4:17
In case the keyboard shortcut in @Rob's comment confuses you, it's Ctrl-b then ,. – Doug Paul Feb 17 '14 at 18:09
Note that when when you rename a window, the field is pre-populated with the current window name (and your cursor is at the end of that name). Since my window name was a long sequence of garbage, I had to hold down Backspace for a minute to clear the current name. For me, visual feedback eventually made it clear that the entire old name had been erased. – Doug Paul Feb 17 '14 at 18:10
you can also use Ctrl-b :rename-window <name goes here>; this uses the tmux command system instead of the keyboard shortcut for that command. – Abbafei Jul 31 '15 at 2:08

This here tries to address all the bits found in other answers and comments. There currently seems only to be a single bit left (see below, missing bit).

First, we kill the status line of tmux and the tty. Afterwards we correct it again, using a method which should be always available (unlike reset).

How to make a tmux terminal (assumes UTF-8) unusable

stty -echo; printf '\016\033k%2000s\\\033\033]2;\355\007' $'\302\217'

Warning: After running above command, the shell looks blind and deaf and seems only to talk bullshit in some unknown alien language. See below on how to repair this.


  • stty -echo kills the terminal type response
  • printf '\016' does a SO, so you are on the alternate character set
  • printf '\033]2;%s\007' 'right status text' sets the right status, in this case $'\355', which exposes a presentation bug
  • printf '\033k%2000s\033\\' $'\302\217' sets the window title name

This might be the combination you can see on the terminal after some interactive command crashed and dropped back into the shell. (With /bin/cat you cannot reach stty -echo IMHO)

Now clean up this mess

stty sane; printf '\033k%s\033\\\033]2;%s\007' "$(basename "$SHELL")" "$(uname -n)"; tput reset; tmux refresh

Note: If you use copy and paste, you probably cannot see your paste if you have used the above command to mess up with your tty. Hence, just blindly press the Enter key after pasting this.


  • stty sane sets "sane" terminal paramters, so you get your echo while typing back
  • printf '\033k%s\033\\' "$(basename "$SHELL")" sets the window title back to normal. You can use tmux rename-window "$(basename "$SHELL")" alternatively, however tmux rename-window is limited to tmux where the escape sequence always works.
  • printf '\033]2;%s\007' "$(uname -n)" resets the status-right to be shown as default. (Note that you should not use tmux set status-right "something", because it just outputs the pane title which got corrupt, so status-right just exposes some presentation bug. Also note that I did not find a tmux command to set the pane title directly.)
  • tput reset resets the terminal, just in case this has been messed with
  • tmux refresh refreshs the screen to get rid of other debris which might have shown up

Missing bit

The printf '\033k%s\033\\' "$(basename "$SHELL")" looses the standard ability of tmux to present the current command in the left status area, which is sad.

I did not find a way to restore that capability, once printf '\033k%s\033\\' "something" was executed. Perhaps someone else can solve this bit to complete the puzzle.

share|improve this answer
Please note the uname -n instead of hostname -s. hostname is dangerous in root context, as you might end up with your host renamed to -s on elder Linux/Unix where hostname does not grok options. – Tino Jan 5 at 13:00
Not resetting the pane title makes me sad too; that's why I'm even here in the first place. Thank you for being the only one on the page who at least acknowledges that shortcoming! – EvanED Jan 19 at 22:54
Consider also "tmux setw automatic-rename" after fixing the window title – EB. May 3 at 20:03

simply do this $ reset && tmux rename-window <new_window_name>

share|improve this answer
tmux set-option -g status off && tmux set-option -g status on 

fixed this for me when something other than the window name was corrupted and I couldn't be bothered to figure out what it was.

share|improve this answer

tmux might only constitute part of the problem. You may have to invoke stty sane at the command line. This resets the in-kernel TTY drivers to some set of default values that usually let you proceed. If the TTY drivers are messed up enough, you may have to type stty sane "blind", that is, without on-screen feedback.

share|improve this answer
stty sane doesn't solve the problem either. I do have on-screen feedback, within each of tmux panes I can type and have feedback as normal, but as soon as tmux needs to draw something (e.g. running a new application, switching or resizing panes) the status-bar moves into the panes... – gerrit Oct 4 '12 at 12:39

Try to reload your config file?

Ctrlb, then: :source-file ~/.tmux.conf

share|improve this answer
best solution so far. – dave Sep 29 '15 at 10:41

to fix the issue for me:

I just killed the issue pane and window, and created a new window and pane.

In the issue pane, CTRL+AX and CTRL+AC.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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