Send keys to a pane
// what it does
`send-keys -t <target> 'ls -la' Enter` types the given keys into a target pane as if you'd typed them, then the literal `Enter` keyword submits the line. The `-t mysession:0` (or just `-t 0`) selects the target by session:window.pane. This is the core primitive for scripting or automating a running tmux session from the outside — feeding commands into a pane without switching to it.
// shell
$ tmux send-keys -t mysession:0 'ls -la' Enter// tmux command
: send-keys -t 0 'ls -la' Enter// gotcha
`Enter` must be a separate argument, not part of the quoted string — putting `\n` inside the quotes types a literal backslash-n instead of running the command. And if your key argument starts with `-`, put `--` before it (e.g. `send-keys -- -foo`) so send-keys doesn't parse it as a flag; `-l` alone won't do it — that flag forces literal key interpretation, not option termination.