How to Dump the text on a virtual console to a file

If you're trying to fix a problem you might want to capture the output of a command for reproduction on a website forum, along with the command you typed to get the results. If you're working in a terminalwindow you can cut and paste, but what if you're working at a virtual console? If you simply want to capture the result of a command, just redirect the output:

$ ls > output.txt 2>&1

This will send both the output and error output (if any) of the ls command to output.txt. If you want to capture the command you typed, and any other command-line detritus (including output), use the screendump command. The following will send everything currently on the current screen (command-line prompts included) to a text file called output.txt:

$ sudo screendump > output.txt

The command has to be issued as root because of permission issues but the resulting file will be owned by you.





Tags: screendump,console

Related Articles