Follow as below, i tried this in Ubuntu 18.04 LTS
All commands to be execute without quotes
1) Use "prefix + :"
2) Type "capture-pane -S -5000 + Return"
Replace -5000 with the number of lines you'd like to save, or with - for all lines. This copies those lines into a buffer.
3) To save the buffer to a file, type "prefix + :"
4) Type in "save-buffer filename.txt + return".
By default Prefix is Ctrl+B for tmux