Skip to main content
Browse referenceAll guides
Back to Commands
Miscellaneous

pipe-pane

Short form: pipep

Pipe a pane's output to a shell command for live logging. With no command, any existing pipe is stopped.

How pipe-pane works

pipe-pane sends everything a pane prints to a shell command while the pane keeps working normally. The usual use is logging: pipe the output into cat >> file and you have a live record of everything that pane shows.

A pane can have one pipe at a time. Running pipe-pane with no command closes the current pipe, and -o only opens a pipe if none exists, so a single key can toggle logging on and off. The command can use status-line style sequences such as #S, #I, and #P, which expand to the session name, window index, and pane index.

-O, the default, connects the pane's output to the command. -I does the reverse: whatever the command prints is typed into the pane.

Synopsis

bash
tmux pipe-pane [-IOo] [-t target-pane] [shell-command]

Options

FlagDescription
-oOnly start a pipe if none is open, and stop it if one is (toggle)
-IConnect the command's stdout to the pane (input)
-OConnect the pane's output to the command's stdin (default)
-t target-panePane to pipe

Examples

Toggle logging the pane to a file

bash
tmux pipe-pane -o 'cat >> ~/pane.log'

Stop piping the current pane

bash
tmux pipe-pane

In .tmux.conf: Prefix + P turns logging of the current pane on or off, one file per pane.

bash
bind P pipe-pane -o 'cat >> ~/tmux-#S-#I-#P.log' \; display 'Toggled logging'

Keep only the lines that mention errors from the build pane.

bash
tmux pipe-pane -t build 'grep --line-buffered -i error >> ~/build-errors.log'

Default Keybinding

pipe-pane has no default key. Run it from a shell as tmux pipe-pane, type it at the command prompt (Ctrl+b then :), or give it a key with bind-key.

Common Mistakes

  • Logs contain raw terminal codes for colors and cursor movement, so they look messy in an editor. Use less -R to read them, or capture-pane -p for clean text.
  • It only records output from the moment the pipe starts. For what is already on screen or in history, use capture-pane.
  • Log files grow forever. Rotate or delete them, especially for panes that run noisy programs.

Pro Tips

  • •Use -o so a single key toggles logging on and off
  • •#W in the command expands to the window name for per-window logs