@Hamlet , here you are
In fact, at least two options.
- "Output redirection"
E.g. you want to issue ip a and save the result in the file named ip_a.txt
ip a > ip_a.txt 2>&1
Notes:
a)>overwrites the file
b)>>appends to the file
c) Don't use space etc. in filenames. Use _ (underscore) instead. That's whyip_a.txtnotip a.txt
d) In many situations you can omit2>&1for speed. I included it for completeness - it's needed to save also the "standard error output" (2) in the file (in case the command produces not only "standard output" (1) , but also (or only) "standard error output" (2)).
e) Be careful not to modify accidentally some existing file.
f) In the resulting file there are no the command itself, just the result. To document what command exactly produced that result, it's worth to edit the file and paste the command at the beginning of the file.
For a short description of redirections see e.g. https://www.redhat.com/en/blog/redirect-operators-bash
To preserve the exact formatting it's better to use the first option ("output redirection").
- Installing
gpmpackage. It enables you to use a mouse to select, copy, paste in a text console without GUI.
Notes:
a) Readman gpmbefore starting to use it.
b) Be careful what you copy to paste to the command line. You can easily get an unwanted and potentially disastrous effect.
c) The formatting of a the pasted text may be lost (tabs are replaced with spaces, the places of line-wrapping may change etc.).
Good luck!
Thank you so much for this, much appreciated !
Too bad there is no basic keyboard shortcut/combination which could allow the cursor to move on terminal screen and copy the text.