brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: piping into tmux split-window -I shows output in a new pane

Tmux
~/tips/tip-tmux-split-with-stdin

make 2>&1 | tmux split-window -I

Sends a command's output from a script into a fresh pane.

When a script runs in one pane, I’d like its output somewhere I can look at it later. split-window -I creates a pane that shows whatever you pipe in.

make 2>&1 | tmux split-window -I

The new pane has no prompt. It simply displays the text arriving on standard input, here the output and errors of make. The original pane goes back to its prompt once the pipe is done.

A quick test from any pane:

ls -l /etc | tmux split-window -I -h

Normal split flags work, so -h puts it beside you and -l 15 sets its size. It also works with -d, so focus stays where it was.

The pane doesn’t disappear when the text stops coming. Close it with Ctrl-b x when you are done. Scrolling works as in any pane, through copy mode with Ctrl-b [.

It is a neat trick for scripts too, where a long report can go into its own pane instead of flooding the one you are working in.

Further reading: tmux manual page (OpenBSD)

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link