2014-01-20

Display the hidden output of a command in a separate tmux pane

Sometimes you want to see what is going on in a middle of a pipe between commands.
For example, vim calls a tool and crashes, the error message doesn't say anything because vim could not parse it.
Here is a trick to copy the output of the command in a separate tmux pane while preserving the original output.
Put a shell script at the place of the original command and rename the original command to here "original_cmd"
#!/bin/bash
/bin/original_cmd | tee `tmux splitw -v -P -F '#{pane_tty}' read`
For example here it will execute "/bin/ls" normally on the top AND copy in realtime its output on a new pane below.

Happy debugging !