In the following steps, run
xrdb ~/.Xressources after modifying the X-resources file, then open a new terminal to test the changes.
Mouse: Hold CtrlLeft-mouse-click. The "Main Options"
menu shows up.
Select "Print-All Immediately" and release. An
XTerm[date] file with the
terminal contents has been created in your home directory.
Keyboard shortcut: To bind the action to
CtrlShifty, add to your
Ctrl Shift <Key> y: print-immediate()
Setting the path:
printFileImmediate sets the prefix of the dumped file.
Useful to specify the path of the dumped file. For example, to dump
Keyboard shortcut: Include in
URxvt.print-pipe: cat > $HOME/scrollback
Binds to Ctrl+Print or Shift+Print.
Not all of them can do it; check their manual page or menu options.
script, a terminal-agnostic solution is to use a multiplexer.
In Tmux, it's a matter of running its internal command
capture-pane -S - ; save-buffer scrollback-file
.tmux.conf would bind it to Ctrl+bCtrl+s:
bind C-s capture-pane -S - \; save-buffer $HOME/scrollback