Print visible contents of tmux session "3", "zsh" window, pane 2:
$ tmux capture-pane -p -t '3:zsh.2'
Print visible contents *and scrollback*:
$ tmux capture-pane -p -S - -t '3:zsh.2' | less
Type "foobar" followed by Enter in that pane:
$ tmux send-keys -t '3:zsh.2' 'foobar' C-m