How to output tmux logging into a file easily

Solution Verified - Updated -

Issue

  • There are many ways to enable logging when working with tmux, here is an easy script that configures it for you and makes it easy to start logging onto a file
[root@gss01 ~]# cat start-tmux-logging.sh 
grep -q tmux.log 2>/dev/null ~/.tmux.conf || cat << _EOF >> ~/.tmux.conf
bind-key H pipe-pane -o "exec cat >>$HOME/'#W-tmux.log'" \; display-message 'Toggled logging to $HOME/#W-tmux.log'
_EOF

tmux new -s tmux-logged

# To enable screen logging press: Ctrl + b followed by H

Environment

  • RHEL 8

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content