Skip to content

Instantly share code, notes, and snippets.

@sayan3296
Created March 1, 2023 12:27
Show Gist options
  • Save sayan3296/794e9742e9af85987cb919c72a8d645f to your computer and use it in GitHub Desktop.
Save sayan3296/794e9742e9af85987cb919c72a8d645f to your computer and use it in GitHub Desktop.
Script to log tmux sesstion output in a file
#!/bin/bash
# To enable screen logging press: Ctrl + b followed by H
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
@sayan3296
Copy link
Author

  • Make the script executable
  • Execute it
  • Hit Ctrl + b and then H to start logging the data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment