There are many ways to capture text or images and save them for later (such as for bug reports, etc):
Highlighting with the mouse is the “copy” portion. Then use the 3rd mouse button to perform a paste (be sure to be in “insert mode” in your editor of choice when pasting. If your 3rd mouse button (both left and right pressed at the same time) doesn’t work, then you should enable it. You can often enable the 3rd mouse button in /etc/X11/XF86Config with
Option "Emulate3Buttons" "yes"
Highlighting with the mosue is the “copy” part. Then you often have a “paste” menu item available so you can paste either in your editor or in your console menu (such as xterm or gnome-terminal).
Occasionally you will find where a CTRL+C, CTRL+V combination will perform a copy/paste, but this is probably rare.
Red Hat 8.0 is configured so that the “Print Screen” key will take a snapshot of the screen and then ask you for a filename to save it as. If you are on a V/K/M switch box that responds to the “Print Screen” key, just press “Print Screen” twice to pass the keystroke through.
You can redirect stdout and stderr which can be saved to file, etc. Here is an example of the “output” operation which will overwrite the destination filename:
ps ax > /tmp/ps_ax.txt
Note that if /tmp/ps_ax.txt exists, it will be overwritten with the results of the above command.
Here is an example of the “append” operation which will append to the existing file or will create a new file:
ps ax >> /tmp/ps_ax.txt
Note that if /tmp/ps_ax.txt exists, it will have the contents of the above command appended to the end of the file.
I always test if a file exists by using the tab key (bash shell) to perform filename completion — read up on Bash’s file name completion (man bash).
Also note that stderr is different from stdout. To capture stderr, you need to refer to it as 2 as follows (the 2 must appear directly in front of the greater than sign — no spaces):
./myprog 2> my_stderr.txt
If you have items on one of the text consoles that you need (and you don’t have to scroll to see it) then you can capture it using virtual console:
cat /dev/vcs1 > /tmp/vcs1.txt
If you have a lot of reproducible output to capture you can use “script” to capture it. Simply run the command “script” and you will be placed back at the shell prompt. Then recreate your output, and when done type “exit”. You will be presented with a message that your results have been stored in a file called “typescript”.
Here are some sample ways:
cat /dev/vcs1 >> results.txt
setterm -dump n (where n is the console you wish to dump – results are stored in screen.dump in current directory)
serial cable / minicom logging feature
So if you already have the text on a text console (usually F1 thru F6) and you need to capture it, then use something like the following:
cat /dev/vcs1 >> results.txt
A similar method is “setterm -dump 1”
Replace the number 1 (in both methods listed above) with the correct console you wish to capture (console F1 = /dev/vcs1, console F3 = /dev/vcs3, etc.)
I’m afaid that information that has already scrolled up beyond the visible screen (usually 25 lines) is in the video buffer and so I don’t have a method to capture that text — you’ll have to regenerate the data and use another means to capture it.
If you can generate the data you need to capture, then just send the output to a file:
./myprog >>results.txt 2>>results_err.txt
Or if you need to keep working on the data produced by your program, then use “tee” as follows:
./myprog | tee -a results.txt | _other_commands_you_have_to_keep_working_on_data
Another method is to use “script” as follows:
All data that is produced before you type the word exit will be captured into the filename typescript.
Capturing just one window in X-windows
then just point and click the crosshairs provided on the window to capture.
Capturing the entire X-Windows screen:
import -window root results.jpg
Or you can add a pause (so you can get ready first) with:
import -pause 3 -window root results.jpg
Of course you’ll have to count down yourself or here’s a couple of ways to let yourself know when the picture has already been taken.
If you have sound, then you could do this:
import -pause 3 -window root results.jpg; play done.wav
If you don’t have sound, then just start something like xcalc:
import -pause 3 -window root results.jpg; xcalc
Then when you hear the sound or you see the calculator pop up you know that the image has already been captured — the pause gives you time to move your text box out of the way before the image is captured.
Some collection tools:
The Linux Trace Toolkit:-
Compaq Survey Utility:-
For Redhat only:-
http://syseng.zko.dec.com/~seger/ – collect for linux