Is it possible to use the keyboard in order to select some text in the terminal windows that is not in the currently edited line? (for example, in order to copy part of previous command output).
As far as I know, neither of the "big three" terminal emulators can do that, but both
tmux offer a scrollback buffer you can access via keyboard.
screen's Prefix key is Ctrl+A per default, but all of that is customizable, so with a default config:
Enter copy mode with Ctrl+A[.
Move cursor around with
vimotions: h, j, k, l, 0, ^, $, H, M, L, w, b, e, /, ?, g and G all work (see
copyfor more info on key bindings).
Start selecting with Space, move around, and stop selecting with Space again. This will leave copy mode.
Paste the selected text with Ctrl+A].
tmux behaves pretty much the same, except it uses some different keys per default:
Enter copy mode with Ctrl+B[.
Move cursor around with ←, ↓, ↑, →, PgUp, PgDown etc. (see
man tmux | less -p '^WINDOWS AND PANES'for the list of copy-mode bindings).
Start selecting with Ctrl+Space, move around, and stop selecting with Meta+w. This will leave copy mode.
Paste the selected text with Ctrl+B].
Depends on the terminal you use. It is possible in shell mode in
It's not quite what you're asking, but if you redirect output through xclip, you can pull it from the clipboard and edit it. I never thought about using it to minimize keyboard use.
$ echo "this is the primary buffer" | xclip -selection "primary" $ cat << EOF > primary.txt > this is the primary buffer > EOF
Under gnome-terminal, I can use shift-insert to paste into the here-file. From the man page xclip -selection "clipboard" does the real clipboard instead of the x buffer.
I can't seem to get it working with tee though... hmmm.... that's kind of important.