Tmux save all output (history) to file

bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'

Add above in tmux.conf. Then do Prefix+Shift+P