Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

This is probably simple, but I really can't find out how you do it. I have read the man pages and googled without results.

Problem: How do I run a command in a detached tmux window?

Example: I want my detached window 'foo' to run 'ls', but I want to do it from another terminal.

I've tried stuff like: 'tmux -t foo ls' without results.

share|improve this question
up vote 17 down vote accepted

The command is send. send is a key sequence, so treat it accordingly (e.g. you'll probably want ENTER). The target is specified with -t. You may want foo.0 or foo.1 depending on the pane you wish to hit.

tmux send -t foo.0 ls ENTER

send is short for send-keys, which is located in the man pages, but perhaps a bit difficult to find in that mile of text.

share|improve this answer
Great answer. Very informative and works a charm. Thanks! – Accatyyc Dec 10 '11 at 15:10

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.