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

In my shell I have flow control disabled using stty -ixon. This works perfectly in the shell and when I launch tmux and start programs within tmux.

However, when starting a new session from the command line and directly launching a command, the flow control setting is not respected and ctrl-s freezes the terminal.

This works:

tmux new-session -s foo

This does not respect the stty flow control setting:

tmux new-session -s foo vim

How can I disable flow control even in the latter case?

share|improve this question
Is it sufficient to disable flow control all together within tmux for all cases, or are you interested in nailing down why it works in the first example but not the second? – slm May 14 '13 at 0:12
@slm In the first place I'd like to have it fixed. Nevertheless, I'm interested why tmux behaves as it does. – Marco May 14 '13 at 6:51
up vote 5 down vote accepted

If you have stty -ixon in your shell's initialization, it's rather simple: when tmux creates new terminals, it runs user's default shell by default and that in turn disables the control flow during the initialization. However, when you ask tmux to run a specific command (ViM in your case), no initialization takes place and the default terminal settings (flow control enabled) apply.

tmux new-session -s foo "stty -ixon; vim"

should fix your problem.

share|improve this answer

A workaround which does not require changing the tmux call is to include the stty call in the file $HOME/.zshenv. This file is parsed by ZSH and used even for non-interactive shells.

echo 'stty -ixon' > ~/.zshenv

BASH users have to set the environment variable BASH_ENV=$HOME/.zshenv to make this work.

share|improve this answer
I don't know what it does, but it did the trick. Added it to both .zshrc and .zshenv. Be careful with > though. Use: echo 'stty -ixon' >> ~/.zshenv – firedev Apr 12 '15 at 9:32

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.