Klaus Zimmermann's Corner

Status on 2021/02/03, 09:36

After searching so long for a solution as to how can I pipe content in and out of the tmux buffer, I finally found a sane, simple answer. And what's best, it is built-in inside the tmux functions.

Simply put, I wanted a way to load the "clipboard" of tmux by piping output into it, much like you can do with xclip or xsel like command | xsel -ib and then that output would be available for you to paste with standard Ctrl+V. And yes, you can do it using only the tmux buffer too:

command | tmux loadb - 

Now you can paste the output of command into any tmux pane with the Prefix Seqquence + ] combination. Now, why would I want to do that? For cases where I'm ssh'ing into a server with its own tmux session and need to pass data along different panes, or when I'm down to just bare Linux console.

Pretty neat trick!