How to copy complete content on terminal to a text file using commands .
You can use
As in the man page:
screendump - dump the contents of a virtual console to stdout
You'll need root privileges to run screendump, so use sudo.
As far as terminal emulators go ( GUI ) you can select the text with mouse and switch to text editor ( be it gedit or anything else ) and press Ctrl + Button 2 ( Scroll wheel on mouse and Right+Left click on touchpad )
With TTY you could use
cat /dev/vcs1 to dump contents of TTY1.
Best approaches , however, should use terminal multiplexers such as
byobu or use
script command to record the whole session to file.
When you execute the command in terminal, for example:
Just add the > or >> symbols and file_name. For example:
lspci > log_file.txt ... create/overwrite log_file.txt
lspci >> log_file.txt ... append to the file
The output will be saved in given file. Of course, if you want to save it in some other directory than present directory you just add path to the log_file.txt in front of filename.